fix bug regarding changed owner id for private/own addressbook, as private addressbook holds a special id in activesync, resulting in failed sync of private addressbook entrys

This commit is contained in:
Klaus Leithoff 2011-12-20 14:29:10 +00:00
parent a1df0766a7
commit 4a65e417c5

View File

@ -496,6 +496,13 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo(); if (!isset($this->addressbook)) $this->addressbook = new addressbook_bo();
$this->backend->splitID($folderid, $type, $account); $this->backend->splitID($folderid, $type, $account);
$is_private = false;
if ($account == self::PRIVATE_AB)
{
$account = $GLOBALS['egw_info']['user']['account_id'];
$is_private = true;
}
// error_log(__METHOD__. " Id " .$id. " Account ". $account . " FolderID " . $folderid); // error_log(__METHOD__. " Id " .$id. " Account ". $account . " FolderID " . $folderid);
if ($type != 'addressbook') // || !($contact = $this->addressbook->read($id))) if ($type != 'addressbook') // || !($contact = $this->addressbook->read($id)))
{ {
@ -579,6 +586,7 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
if (!$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']) if (!$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
{ {
$contact['owner'] = $account; $contact['owner'] = $account;
$contact['private'] = $is_private;
} }
if (!empty($id)) $contact['id'] = $id; if (!empty($id)) $contact['id'] = $id;
$this->addressbook->fixup_contact($contact); $this->addressbook->fixup_contact($contact);
@ -706,6 +714,10 @@ class addressbook_activesync implements activesync_plugin_write, activesync_plug
} }
} }
} }
if ($owner == self::PRIVATE_AB)
{
$owner = $GLOBALS['egw_info']['user']['account_id'];
}
$ctag = $this->addressbook->get_ctag($owner); $ctag = $this->addressbook->get_ctag($owner);
$changes = array(); // no change $changes = array(); // no change