From da872fae0c2d3ff4af6d10820711e5d833a508a5 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 8 Apr 2010 13:19:13 +0000 Subject: [PATCH] if there is a personal addressbook (positive ID) selected as Default or forced; assume users own ID, as it is handled in addressbook settings (addressbook to add new contacts to) --- addressbook/inc/class.addressbook_sif.inc.php | 16 +++++++++------- addressbook/inc/class.addressbook_vcal.inc.php | 11 ++++++++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/addressbook/inc/class.addressbook_sif.inc.php b/addressbook/inc/class.addressbook_sif.inc.php index 8ad5a9e4bd..fc451406ca 100644 --- a/addressbook/inc/class.addressbook_sif.inc.php +++ b/addressbook/inc/class.addressbook_sif.inc.php @@ -238,13 +238,15 @@ class addressbook_sif extends addressbook_bo $contact['id'] = $_abID; } elseif (array_key_exists('filter_addressbook', $GLOBALS['egw_info']['user']['preferences']['syncml'])) - { - $contact['owner'] = (int) $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook']; - if ($contact['owner'] == -1) - { - $contact['owner'] = $GLOBALS['egw_info']['user']['account_primary_group']; - } - } + { + $contact['owner'] = (int) $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook']; + if ($contact['owner'] == -1) + { + $contact['owner'] = $GLOBALS['egw_info']['user']['account_primary_group']; + } + // if there is a positive id as filter it is to be interpreted as "Personal Addressbook" + if ($contact['owner'] > 0) $contact['owner'] = $GLOBALS['egw_info']['user']['account_id']; + } return $this->save($contact); } diff --git a/addressbook/inc/class.addressbook_vcal.inc.php b/addressbook/inc/class.addressbook_vcal.inc.php index 05a0d31b6f..91f82607f4 100644 --- a/addressbook/inc/class.addressbook_vcal.inc.php +++ b/addressbook/inc/class.addressbook_vcal.inc.php @@ -166,6 +166,8 @@ class addressbook_vcal extends addressbook_bo { $contact['owner'] = $GLOBALS['egw_info']['user']['account_primary_group']; } + // if there is a positive id as filter it is to be interpreted as "Personal Addressbook" + if ($contact['owner'] > 0) $contact['owner'] = $GLOBALS['egw_info']['user']['account_id']; if (is_array($contact['category'])) { $contact['category'] = implode(',',$this->find_or_add_categories($contact['category'], -1)); @@ -931,7 +933,14 @@ class addressbook_vcal extends addressbook_bo if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook'])) { - $contact['owner'] = $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook']; + //$contact['owner'] = $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook']; + $contact['owner'] = (int) $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook']; + if ($contact['owner'] == -1) + { + $contact['owner'] = $GLOBALS['egw_info']['user']['account_primary_group']; + } + // if there is a positive id as filter it is to be interpreted as "Personal Addressbook" + if ($contact['owner'] > 0) $contact['owner'] = $GLOBALS['egw_info']['user']['account_id']; } $this->fixup_contact($contact);