forked from extern/egroupware
When deleting but keeping contacts, hold on to links as well so they can be restored if contact is restored.
This commit is contained in:
parent
272d30c3a7
commit
d7168805c9
@ -724,6 +724,7 @@ class addressbook_bo extends addressbook_so
|
||||
$delete = $old;
|
||||
$delete['tid'] = addressbook_so::DELETED_TYPE;
|
||||
$ok = $this->save($delete);
|
||||
egw_link::unlink(0,'addressbook',$id,'','','',true);
|
||||
}
|
||||
elseif (($ok = parent::delete($id,$check_etag)))
|
||||
{
|
||||
@ -848,6 +849,12 @@ class addressbook_bo extends addressbook_so
|
||||
// Notify linked apps about changes in the contact data
|
||||
egw_link::notify_update('addressbook', $contact['id'], $contact);
|
||||
|
||||
// Check for restore of deleted contact, restore held links
|
||||
if($old['tid'] == addressbook_so::DELETED_TYPE && $contact['tid'] != addressbook_so::DELETED_TYPE)
|
||||
{
|
||||
egw_link::restore('addressbook', $contact['id']);
|
||||
}
|
||||
|
||||
// Record change history for sql - doesn't work for LDAP accounts
|
||||
if(!$contact['account_id'] || $contact['account_id'] && $this->account_repository == 'sql') {
|
||||
$deleted = ($old['tid'] == addressbook_so::DELETED_TYPE || $contact['tid'] == addressbook_so::DELETED_TYPE);
|
||||
|
@ -1516,6 +1516,12 @@ class addressbook_ui extends addressbook_bo
|
||||
'to_id' => $content['link_to']['to_id'],
|
||||
);
|
||||
|
||||
// Links for deleted entries
|
||||
if($content['tid'] == addressbook_so::DELETED_TYPE)
|
||||
{
|
||||
$content['link_to']['show_deleted'] = true;
|
||||
}
|
||||
|
||||
// Enable history
|
||||
$this->setup_history($content, $sel_options);
|
||||
|
||||
@ -1690,6 +1696,11 @@ class addressbook_ui extends addressbook_bo
|
||||
'to_app' => 'addressbook',
|
||||
'to_id' => $content['id'],
|
||||
);
|
||||
// Links for deleted entries
|
||||
if($content['tid'] == addressbook_so::DELETED_TYPE)
|
||||
{
|
||||
$content['link_to']['show_deleted'] = true;
|
||||
}
|
||||
$readonlys['link_to'] = $readonlys['customfields'] = $readonlys['fileas_type'] = true;
|
||||
$readonlys['button[save]'] = $readonlys['button[apply]'] = $readonlys['change_photo'] = true;
|
||||
$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content);
|
||||
|
Loading…
Reference in New Issue
Block a user