* CardDAV/Addressbook: fixed not working delete of contacts

This commit is contained in:
Ralf Becker 2012-10-01 17:23:44 +00:00
parent a52876ad6a
commit 4e2a7dab80
3 changed files with 14 additions and 8 deletions

View File

@ -752,7 +752,8 @@ class addressbook_bo extends addressbook_so
{
$delete = $old;
$delete['tid'] = addressbook_so::DELETED_TYPE;
$ok = $this->save($delete);
if ($check_etag) $delete['etag'] = $check_etag;
if (($ok = $this->save($delete))) $ok = true; // we have to return true or false
egw_link::unlink(0,'addressbook',$id,'','','',true);
}
elseif (($ok = parent::delete($id,$check_etag)))

View File

@ -851,12 +851,15 @@ class addressbook_groupdav extends groupdav_handler
{
return $contact;
}
if (($Ok = isset($contact['list_id']) ? $this->bo->delete_list($contact['list_id']) !== false :
$this->bo->delete($contact['id'],self::etag2value($this->http_if_match))) === 0)
if (isset($contact['list_id']))
{
$ok = $this->bo->delete_list($contact['list_id']) !== false;
}
elseif (($ok = $this->bo->delete($contact['id'],self::etag2value($this->http_if_match))) === 0)
{
return '412 Precondition Failed';
}
return $Ok;
return $ok;
}
/**

View File

@ -590,7 +590,7 @@ class egw_link extends solink
}
// Log in history
if(!$app || !$app2)
if($link_id && (!$app || !$app2))
{
// Need to load it first
$link = self::get_link($link_id);
@ -599,9 +599,11 @@ class egw_link extends solink
$app2 = $link['link_app2'];
$id2 = $link['link_id2'];
}
historylog::static_add($app,$id,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app2.':'.$id2);
historylog::static_add($app2,$id2,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app.':'.$id);
if ($app && $app2)
{
historylog::static_add($app,$id,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app2.':'.$id2);
historylog::static_add($app2,$id2,$GLOBALS['egw_info']['user']['account_id'],'~link~','',$app.':'.$id);
}
$deleted =& solink::unlink($link_id,$app,$id,$owner,$app2 != '!'.self::VFS_APPNAME ? $app2 : '',$id2,$hold_for_purge);
// only notify on real links, not the one cached for writing or fileattachments