CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.3 Release Testing (Moderator: pdelbar) »
  • [Fixed] Sql error with FK_civicrm_line_item_financial_type_id
Pages: [1]

Author Topic: [Fixed] Sql error with FK_civicrm_line_item_financial_type_id  (Read 1798 times)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
[Fixed] Sql error with FK_civicrm_line_item_financial_type_id
March 07, 2013, 03:10:22 pm
When upgrading a 4.2.7 site to 4.3 b2 I get the error:
nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`d6_crm`.`civicrm_line_item`, CONSTRAINT `FK_civicrm_line_item_financial_type_id` FOREIGN KEY (`financial_type_id`) REFERENCES `civicrm_financial_type` (`id`))

Does that ring a bell with anyone? This is during [Create financial records for contributions]

The sql query is:
UPDATE civicrm_line_item li LEFT JOIN civicrm_contribution con ON (li.entity_id = con.id AND li.entity_table = 'civicrm_contribution') LEFT JOIN civicrm_price_field_value cpfv ON li.price_field_value_id = cpfv.id LEFT JOIN civicrm_participant cp ON (li.entity_id = cp.id AND li.entity_table = 'civicrm_participant') LEFT JOIN civicrm_event ce ON ce.id = cp.event_id SET li.financial_type_id = CASE WHEN (con.contribution_page_id IS NULL || li.price_field_value_id IS NULL) AND cp.id IS NULL THEN con.financial_type_id WHEN (con.contribution_page_id IS NOT NULL AND cp.id IS NULL) || (cp.id IS NOT NULL AND li.price_field_value_id IS NOT NULL) THEN cpfv.financial_type_id WHEN cp.id IS NOT NULL AND li.price_field_value_id IS NULL THEN ce.financial_type_id END
« Last Edit: April 09, 2013, 02:29:34 pm by Coleman Watts »
Try asking your question on the new CiviCRM help site.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: [Fixed] Sql error with FK_civicrm_line_item_financial_type_id
April 09, 2013, 02:29:55 pm
See https://github.com/civicrm/civicrm-core/pull/358
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.3 Release Testing (Moderator: pdelbar) »
  • [Fixed] Sql error with FK_civicrm_line_item_financial_type_id

This forum was archived on 2017-11-26.