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:
- In the civicrm_contribution table, the contribution_status_id for the contribution in question needs to be changed from
4
to 1
.
- 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.)
- 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).
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.