* Admin/Addressbook: do NOT mark accounts as deleted, as accounts do NOT know that state, always deleted them and allow to cleanup already marked as deleted accounts in addressbook

This commit is contained in:
Ralf Becker 2012-03-07 12:05:35 +00:00
parent 36f9cc2f6a
commit 08e40605cc
2 changed files with 11 additions and 5 deletions

View File

@ -746,7 +746,10 @@ class addressbook_bo extends addressbook_so
if ($this->check_perms(EGW_ACL_DELETE,$c,$deny_account_delete))
{
if (!($old = $this->read($id))) return false;
if ($this->delete_history != '' && $old['tid'] != addressbook_so::DELETED_TYPE)
// check if we only mark contacts as deleted, or really delete them
// already marked as deleted item and accounts are always really deleted
// we cant mark accounts as deleted, as no such thing exists for accounts!
if ($old['owner'] && $this->delete_history != '' && $old['tid'] != addressbook_so::DELETED_TYPE)
{
$delete = $old;
$delete['tid'] = addressbook_so::DELETED_TYPE;
@ -767,11 +770,12 @@ class addressbook_bo extends addressbook_so
}
else
{
break;
}
}
//error_log(__METHOD__.'('.array2string($contact).', deny_account_delete='.array2string($deny_account_delete).', check_etag='.array2string($check_etag).' returning '.array2string($ok));
return $ok;
}
}
return true;
}
/**
* saves contact to db

View File

@ -948,9 +948,11 @@ class addressbook_ui extends addressbook_bo
$action_msg = lang('deleted');
if (($Ok = !!($contact = $this->read($id)) && $this->check_perms(EGW_ACL_DELETE,$contact)))
{
if ($contact['owner']) // regular contact
if ($contact['owner'] || // regular contact or
// already deleted account (should no longer happen, but needed to allow for cleanup)
$contact['tid'] == addressbook_so::DELETED_TYPE)
{
$Ok = $this->delete($id);
$Ok = $this->delete($id, $contact['tid'] != addressbook_so::DELETED_TYPE);
}
// delete single account --> redirect to admin
elseif (count($checked) == 1 && $contact['account_id'])