2

I need to manually change a one-time Failed contribution in the database to a Completed contribution. (See How do I change an incorrect contribution status to Completed? for context). What tables and fields in the database do I need to adjust in order to make the change successfully?

Drupal 7, Civi 4.6

2

In Civi 4.6, when a contribution is made, an entry is recorded in the following three database tables: civicrm_contribution, civicrm_financial_item, and civicrm_line_item. If a contribution is marked as Failed, other entries in other tables do not get made (these other entries are needed for CiviAccounting features like Exporting Accounting Batches). To change the Failed contribution to Completed after the fact, follow the below steps:

  1. In the civicrm_contribution table, the contribution_status_id for the contribution in question needs to be changed from 4 to 1.
  2. In the civicrm_financial_item table, the status_id for the contribution needs to be changed from 3 to 1. (You can identify the exact contribution in this table using the entity_id field. The entity_id here comes from the id field in the civicrm_line_item table.)
  3. In the civicrm_financial_trxn table, create an entry. (This entry must be created before Step 4, so the entries in Step 4 have a financial_trxn record to reference).
  4. In the civicrm_entity_financial_trxn table, create two entries.

    4a) The first entry will have 'civicrm_contribution' in the entity_table field and the contribution ID of the contribution itself in the entity_id field. The financial_trxn_id field will use the the id from the entry you created in Step 3.

    4b) The second entry will have 'civicrm_financial_item' in the entity_table field and the id from the civicrm_financial_item table in the entity_id field. Again, the financial_trxn_id field will use the id from the entry you created in Step 3.

  • 1
    could the API explorer be used for this? – petednz - fuzion Aug 9 '17 at 18:40
  • Oh, good thought, Pete. I'll have to try that in our dev environment. – Allen Hutchison Aug 10 '17 at 2:04
  • Has there been any implementation of a more user friendly way to go through this process? – J. Rolfs Apr 26 '18 at 21:19
  • Not that I'm aware of. – Allen Hutchison Apr 26 '18 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.