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)

This commit is contained in:
Klaus Leithoff 2010-04-08 13:19:13 +00:00
parent ddb2ff2155
commit da872fae0c
2 changed files with 19 additions and 8 deletions

View File

@ -238,13 +238,15 @@ class addressbook_sif extends addressbook_bo
$contact['id'] = $_abID; $contact['id'] = $_abID;
} }
elseif (array_key_exists('filter_addressbook', $GLOBALS['egw_info']['user']['preferences']['syncml'])) elseif (array_key_exists('filter_addressbook', $GLOBALS['egw_info']['user']['preferences']['syncml']))
{ {
$contact['owner'] = (int) $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook']; $contact['owner'] = (int) $GLOBALS['egw_info']['user']['preferences']['syncml']['filter_addressbook'];
if ($contact['owner'] == -1) if ($contact['owner'] == -1)
{ {
$contact['owner'] = $GLOBALS['egw_info']['user']['account_primary_group']; $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); return $this->save($contact);
} }

View File

@ -166,6 +166,8 @@ class addressbook_vcal extends addressbook_bo
{ {
$contact['owner'] = $GLOBALS['egw_info']['user']['account_primary_group']; $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'])) if (is_array($contact['category']))
{ {
$contact['category'] = implode(',',$this->find_or_add_categories($contact['category'], -1)); $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'])) 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); $this->fixup_contact($contact);