Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-12156

Cannot permanently delete a contact for whom a contribution has been created

    Details

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgg David Greenberg
                Reporter:
                kirk Kirk Jackson
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h