Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.3.0, 4.3.4
-
Component/s: CiviContribute, Core CiviCRM
Description
UPDATE: Permanent delete will be blocked for contacts w/ live financial transactions unless the site system administrator implements a special setting. See CRM-12929 for details.
A fatal database error occurs when trying to permanently delete a contact for whom a contribution has been created.
This is because when a contribution is created, it creates a associated record in the civicrm_financial_item table, which has a foreign key referring to the contact record. Attempting to delete the contact violates this foreign key constraint.
Suggested fix: add ON DELETE CASCADE to the foreign key constraint (FK_civicrm_financial_item_contact_id). This would be consistent with the foreign key referring from civicrm_contribution to civicrm_contact (FK_civicrm_contribution_contact_id).
Note: This error only occurs when trying to permanently delete a contact. It does not occur when just moving a contact to the trash.
Note: This error occurs even if you delete all the contact's contributions before trying to permanently delete the contact. This is because deleting a contribution fails to delete the associated financial item (see CRM-12155).
Applies to CiviCRM 4.3 beta 3.