Details
-
Type:
Task
-
Status: Done/Fixed
-
Priority:
Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.3.4
-
Fix Version/s: 4.3.5
-
Component/s: Accounting Integration
-
Labels:None
Description
In order to preserve audit-ability of CiviCRM sites we should prevent loss of live financial data. However we need a work-around for situations where a large quantify of dummy data has been created and needs to be cleaned up (and / or for sites which just don't care about audit-ability).
1. Define a new 'hidden' setting which a system admin with access to civicrm.settings.php can add that will modify the default "no permanent delete" behavior.
$civicrm_setting['CiviCRM Preferences']['allowPermDeleteFinancial'] = 1 (see this wiki page for details on 'hidden settings'; check implementation of this setting for an example: $civicrm_setting['CiviCRM Preferences']['communityMessagesUrl']). If undefined, default for this setting is 0 (false). http://wiki.civicrm.org/confluence/display/CRMDOC43/Override+CiviCRM+Settings
2. Modify CRM_Contact_BAO_Contact::contactDelete to check for linked "live" financial transactions for this contact prior to beginning delete processing UNLESS allowPermDeleteFinancial is TRUE. I think we can limit this to SELECT id FROM civicrm_contribution where contact_id = $id AND is_test = 0;
QUESTION: Can we think of any use cases where a contact would be linked to a financial_trxn row but NOT be linked to any contribution rows ??
Pradeep should review this question as well. I can't think of use cases that we have implemented where this would be so. Going forward, we need to worry about Grants, also payments for a contribution by 3rd parties ie not the civicrm_contribution.contact_id.
If we find > 0 live transactions, abort the delete with this status message:
"This contact can not be permanently deleted because the contact record is linked to one or more live financial transactions. Deleting this contact would result in the loss of financial data."
3. Verify civicrm_api3_contribution_delete behavior. It should be consistent since it just calls the BAO - but it would be good if we could pass the status message above back out.
Attachments
Issue Links
- provides patch for
-
CRM-12156 Cannot permanently delete a contact for whom a contribution has been created
-
- Done/Fixed
-