Details
-
Type: New Feature
-
Status: Done/Fixed
-
Priority: Critical
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1
-
Fix Version/s: 3.2
-
Component/s: CiviCase, Core CiviCRM
-
Labels:None
Description
Implement contact trash and restore.
Ramifications:
— a per-site option (default: on) to move contacts to trash instead of deleting;
— if the above option is enabled, any deleted contact is moved to trash for possible future restore;
— the contact's data (everything - from civicrm_contact info like their contact preferences, through that-contact-only-dependant entities like notes, to the contact's relations with other entities like event participation or relationships) should be restorable in full;
— until restored, the trashed contact should be treated as non-existent unless a query explicitly concerns deleted status (by providing an is_deleted value, for example).
Current implementation idea:
— add civicrm_contact.is_deleted flag;
— adjust contacts' DAO to set that flag upon deletes (rather than delete the entries);
— fix all searches, API calls, views, relationships, counts, etc. throughout CiviCRM to consider is_deleted contacts as non-existent;
— IMPORTANT: adjust contacts' DAO to update only is_deleted=false contacts;
— in general, assess whether any civicrm_contact.* updates should affect is_deleted=true contacts;
— treat is_deleted contacts as non-existent - e.g., do not distinguish between accessing a trashed an non-existent contacts' pages;
— in general, if at all possible treat the is_deleted as a static property of a contact that should be taken into account rather than taking action upon trashing/restore; in other words, do not script the trashing/restore code but rather teach all the other places to omit is_deleted contacts;
— if either the per-site trash is disabled or a trashed contact is actually deleted from trash, keep current behaviour.
UI idea:
— if the current user has the relevant (new) permission to search for trashed contacts, add an option to search to include deleted contacts;
— if a search results screen includes a trashed contact (due to the above search being performed), add 'restore' and 'delete permanently' actions;
— [possibly for 3.3?] after contact delete add an undo action, with some sane ACL rules.
Attachments
Issue Links
- blocks
-
CRM-5758 Implement new business rules for handling cases when two contacts are merged
- Done/Fixed