Answers.Body: <p>In Civi 4.6, when a contribution is made, an entry is recorded in the following three database tables: <strong>civicrm_contribution</strong>, <strong>civicrm_financial_item</strong>, and <strong>civicrm_line_item</strong>.  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:</p>
  
  <ol>
  <li>In the <strong>civicrm_contribution</strong> table, the <em>contribution_status_id</em> for the contribution in question needs to be changed from <code>4</code> to <code>1</code>.</li>
  <li>In the <strong>civicrm_financial_item</strong> table, the <em>status_id</em> for the contribution needs to be changed from <code>3</code> to <code>1</code>.  (You can identify the exact contribution in this table using the <em>entity_id</em> field.  The <em>entity_id</em> here comes from the <em>id</em> field in the <strong>civicrm_line_item</strong> table.)</li>
  <li>In the <strong>civicrm_financial_trxn</strong> 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).</li>
  <li><p>In the <strong>civicrm_entity_financial_trxn</strong> table, create two entries.</p>
  
  <p>4a) The first entry will have 'civicrm_contribution' in the <em>entity_table</em>
  field and the contribution ID of the contribution itself in the
  <em>entity_id</em> field.  The <em>financial_trxn_id</em> field will use the the
  <em>id</em> from the entry you created in Step 3.</p>
  
  <p>4b) The second entry will have 'civicrm_financial_item' in the <em>entity_table</em> field and the id from the <strong>civicrm_financial_item</strong> table in the <em>entity_id</em> field.  Again, the <em>financial_trxn_id</em> field will use the <em>id</em> from the entry you created in Step 3.</p></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-09T18:40:24.823Z
Answers.Text: could the API explorer be used for this?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-10T02:04:13.977Z
Answers.Text: Oh, good thought, Pete. I'll have to try that in our dev environment.
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-26T21:19:27.567Z
Answers.Text: Has there been any implementation of a more user friendly way to go through this process?
Answers.UserDisplayName: J. Rolfs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-26T22:02:38.273Z
Answers.Text: Not that I'm aware of.
Answers.UserDisplayName: Allen Hutchison
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-19T22:01:54.903Z
Answers.LastActivityDate: 2017-08-09T16:56:03.077Z
Answers.LastEditDate: 2017-08-09T16:56:03.077Z
Answers.UserDisplayName: Allen Hutchison
Body: <p>I need to manually change a one-time Failed contribution in the database to a Completed contribution.  (See <a href="https://civicrm.stackexchange.com/q/15447/105">How do I change an incorrect contribution status to Completed?</a> for context).  What tables and fields in the database do I need to adjust in order to make the change successfully?</p>
  
  <p>Drupal 7, Civi 4.6</p>
  
Tags: <civicontribute><contributions><database>
Title: Manually adjusting a contribution in the database
ThreadText: # Manually adjusting a contribution in the database
  
  (Asked by: username_0 on 2016-10-19)
  
  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?](https://civicrm.stackexchange.com/q/15447/105) 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
  
  **Tags:** civicontribute, contributions, database
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-10-19. Score: 2 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_1**: could the API explorer be used for this?  
  > **username_0**: Oh, good thought, Pete. I'll have to try that in our dev environment.  
  > **username_2**: Has there been any implementation of a more user friendly way to go through this process?  
  > **username_0**: Not that I'm aware of.  
  
  ---
  
  