* eSync/Addressbook: for all-in-one addressbook only use add-default, if it is contained in addressbooks selected, otherwise use personal addressbook

This commit is contained in:
Ralf Becker 2012-02-08 15:12:37 +00:00
parent caec90f104
commit edb42dbfd2

View File

@ -589,6 +589,13 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
$contact['owner'] = $account; $contact['owner'] = $account;
$contact['private'] = (int)$is_private; $contact['private'] = (int)$is_private;
} }
// if default addressbook for new contacts is NOT synced --> use personal addressbook
elseif($GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default'] &&
!in_array($GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default'],
array_keys($this->get_addressbooks(null,false))))
{
$contact['owner'] = $GLOBALS['egw_info']['user']['account_id'];
}
if (!empty($id)) $contact['id'] = $id; if (!empty($id)) $contact['id'] = $id;
$this->addressbook->fixup_contact($contact); $this->addressbook->fixup_contact($contact);
$newid = $this->addressbook->save($contact); $newid = $this->addressbook->save($contact);