* 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:02 +00:00
parent 000b74bded
commit e03b8471e9
2 changed files with 11 additions and 5 deletions

View File

@ -747,7 +747,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;
@ -768,10 +771,11 @@ class addressbook_bo extends addressbook_so
}
else
{
return $ok;
break;
}
}
return true;
//error_log(__METHOD__.'('.array2string($contact).', deny_account_delete='.array2string($deny_account_delete).', check_etag='.array2string($check_etag).' returning '.array2string($ok));
return $ok;
}
/**

View File

@ -955,9 +955,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'])