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) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Manual Donations DB Error: constraint violation
Pages: [1]

Author Topic: Manual Donations DB Error: constraint violation  (Read 1456 times)

SueCline

  • Guest
Manual Donations DB Error: constraint violation
January 26, 2010, 10:35:35 am
We are trying to manually enter new donations into CiviCRM. When we try to do so, we are getting the following error message, any idea why?

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_value_organizatios_6  ( fund_rasiser_5,program_designation_6,member_affiliation_7,grant_designation_8,grant_period_9,pledge_type_10,pledge_amount_11,on_behalf_of_12,agency_amount_13,annual_appeal_amount_14,annual_appeal_date_15,annual_appeal__in_honor_of_17,annual_appeal__in_memory_of_18,returned_mail_19,fund_rasiser_type_2009_21,program_designation_2009_22,member_affiliation_2009_23,donation_type_2009_24,date_2009_25,amount_2009_26,payment_type_2009_27,notes_28,note_date_29,entity_id ) VALUES ( '','','','','','','','','','','','','',null,'','','','','','','','','',79 ) ON DUPLICATE KEY UPDATE fund_rasiser_5 = '',program_designation_6 = '',member_affiliation_7 = '',grant_designation_8 = '',grant_period_9 = '',pledge_type_10 = '',pledge_amount_11 = '',on_behalf_of_12 = '',agency_amount_13 = '',annual_appeal_amount_14 = '',annual_appeal_date_15 = '',annual_appeal__in_honor_of_17 = '',annual_appeal__in_memory_of_18 = '',returned_mail_19 = null,fund_rasiser_type_2009_21 = '',program_designation_2009_22 = '',member_affiliation_2009_23 = '',donation_type_2009_24 = '',date_2009_25 = '',amount_2009_26 = '',payment_type_2009_27 = '',notes_28 = '',note_date_29 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`will0709_wsacivicrm/civicrm_value_organizatios_6`, CONSTRAINT `FK_civicrm_value_organizatios_6_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_value_organizatios_6  ( fund_rasiser_5,program_designation_6,member_affiliation_7,grant_designation_8,grant_period_9,pledge_type_10,pledge_amount_11,on_behalf_of_12,agency_amount_13,annual_appeal_amount_14,annual_appeal_date_15,annual_appeal__in_honor_of_17,annual_appeal__in_memory_of_18,returned_mail_19,fund_rasiser_type_2009_21,program_designation_2009_22,member_affiliation_2009_23,donation_type_2009_24,date_2009_25,amount_2009_26,payment_type_2009_27,notes_28,note_date_29,entity_id ) VALUES ( '','','','','','','','','','','','','',null,'','','','','','','','','',79 ) ON DUPLICATE KEY UPDATE fund_rasiser_5 = '',program_designation_6 = '',member_affiliation_7 = '',grant_designation_8 = '',grant_period_9 = '',pledge_type_10 = '',pledge_amount_11 = '',on_behalf_of_12 = '',agency_amount_13 = '',annual_appeal_amount_14 = '',annual_appeal_date_15 = '',annual_appeal__in_honor_of_17 = '',annual_appeal__in_memory_of_18 = '',returned_mail_19 = null,fund_rasiser_type_2009_21 = '',program_designation_2009_22 = '',member_affiliation_2009_23 = '',donation_type_2009_24 = '',date_2009_25 = '',amount_2009_26 = '',payment_type_2009_27 = '',notes_28 = '',note_date_29 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`will0709_wsacivicrm/civicrm_value_organizatios_6`, CONSTRAINT `FK_civicrm_value_organizatios_6_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_value_organizatios_6  ( fund_rasiser_5,program_designation_6,member_affiliation_7,grant_designation_8,grant_period_9,pledge_type_10,pledge_amount_11,on_behalf_of_12,agency_amount_13,annual_appeal_amount_14,annual_appeal_date_15,annual_appeal__in_honor_of_17,annual_appeal__in_memory_of_18,returned_mail_19,fund_rasiser_type_2009_21,program_designation_2009_22,member_affiliation_2009_23,donation_type_2009_24,date_2009_25,amount_2009_26,payment_type_2009_27,notes_28,note_date_29,entity_id ) VALUES ( '','','','','','','','','','','','','',null,'','','','','','','','','',79 ) ON DUPLICATE KEY UPDATE fund_rasiser_5 = '',program_designation_6 = '',member_affiliation_7 = '',grant_designation_8 = '',grant_period_9 = '',pledge_type_10 = '',pledge_amount_11 = '',on_behalf_of_12 = '',agency_amount_13 = '',annual_appeal_amount_14 = '',annual_appeal_date_15 = '',annual_appeal__in_honor_of_17 = '',annual_appeal__in_memory_of_18 = '',returned_mail_19 = null,fund_rasiser_type_2009_21 = '',program_designation_2009_22 = '',member_affiliation_2009_23 = '',donation_type_2009_24 = '',date_2009_25 = '',amount_2009_26 = '',payment_type_2009_27 = '',notes_28 = '',note_date_29 = '' [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`will0709_wsacivicrm/civicrm_value_organizatios_6`, CONSTRAINT `FK_civicrm_value_organizatios_6_entity_id` FOREIGN KEY (`entity_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]
)

the backtrace information is:

/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 146
, handle,
/home/will0709/public_html/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 912
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 966
/home/will0709/public_html/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 574
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2394
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1587
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 144
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 866
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, executeQuery, 221
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, create, 319
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php, store, 219
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php, create, 1125
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 248
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, mainProcess, 152
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, realPerform, 129
/home/will0709/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
/home/will0709/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 249
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php, run, 201
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php, edit, 244
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 209
/home/will0709/public_html/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 333
, civicrm_invoke,
/home/will0709/public_html/includes/menu.inc, call_user_func_array, 348
/home/will0709/public_html/index.php, menu_execute_active_handler, 18

We're running 3.0.3

Many thanks!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Manual Donations DB Error: constraint violation
January 26, 2010, 10:46:39 am

can u add:

CRM_Core_Error::debug( $contribution );

to line 215 or so of the file: /home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php (before the if clause)

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

SueCline

  • Guest
Re: Manual Donations DB Error: constraint violation
January 26, 2010, 10:55:55 am
Done, the resulting backtrace when I tried it again:

CRM_Contribute_BAO_Contribution Object
(
    [id] => 80
    [contact_id] => 6223
    [contribution_type_id] => 1
    [contribution_page_id] =>
    [payment_instrument_id] => 4
    [receive_date] => 20091015000000
    [non_deductible_amount] => null
    [total_amount] => 25.00
    [fee_amount] => null
    [net_amount] => null
    [trxn_id] => null
    [invoice_id] => null
    [currency] => USD
    [cancel_date] => null
    [cancel_reason] => null
    [receipt_date] => 20091031000000
    [thankyou_date] => 20091031
    [source] => null
    [amount_level] =>
    [contribution_recur_id] =>
    [honor_contact_id] => 14720
    [is_test] =>
    [is_pay_later] =>
    [contribution_status_id] => 1
    [honor_type_id] => 1
    [address_id] =>
    [check_number] => 16359
    [_DB_DataObject_version] => 1.8.8
    [__table] => civicrm_contribution
    [N] => 0
    [_database_dsn] =>
    [_database_dsn_md5] => 290390e4c6a66b85d8350de71136ddff
    [_database] => will0709_wsacivicrm
    [_query] => Array
        (
            [condition] =>
            [group_by] =>
            [order_by] =>
            [having] =>
            [limit_start] =>
            [limit_count] =>
            [data_select] => *
        )

    [_DB_resultid] =>
    [_resultFields] =>
    [_link_loaded] =>
    [_join] =>
    [_lastError] =>
    [trxn_result_code] =>
    [payment_processor] =>
)

backTrace

/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 146
, handle,
/home/will0709/public_html/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 912
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 966
/home/will0709/public_html/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 574
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2394
/home/will0709/public_html/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1587
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 144
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 866
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, executeQuery, 221
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, create, 319
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php, store, 227
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php, create, 1125
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 248
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, mainProcess, 152
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, realPerform, 129
/home/will0709/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
/home/will0709/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 249
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php, run, 201
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php, edit, 244
/home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 209
/home/will0709/public_html/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 333
, civicrm_invoke,
/home/will0709/public_html/includes/menu.inc, call_user_func_array, 348
/home/will0709/public_html/index.php, menu_execute_active_handler, 18


I forgot to mention that we dropped this patch on earlier today:
http://fisheye2.atlassian.com/changelog/CiviCRM?cs=25780

Last but not least this is apparently impacting Memberships, too, as I can't manually add those either now. That error is:

warning: Cannot modify header information - headers already sent by (output started at /home/will0709/public_html/sites/all/modules/civicrm/CRM/Core/Error.php:306) in /home/will0709/public_html/sites/all/modules/civicrm/CRM/Utils/System.php on line 323.
« Last Edit: January 26, 2010, 01:20:08 pm by SueCline »

TallDavid

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ATO Zeta Mu Alumni
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.52
  • PHP version: 5.2.13
Re: Manual Donations DB Error: constraint violation
January 28, 2010, 07:27:21 pm
I've been trying to help Sue with this issue.  We find that if we disable the Custom Data group that the problem does not occur.  Nothing else that we have tried makes a difference.

Suggestions on how to resolve this issue are appreciated.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Manual Donations DB Error: constraint violation
January 29, 2010, 08:00:48 am

this is a bug here: http://issues.civicrm.org/jira/browse/CRM-5736

this has been fixed and will be part of 3.1.1

you can get the patch from JIRA if u'd like it earlier

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

TallDavid

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ATO Zeta Mu Alumni
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.52
  • PHP version: 5.2.13
Re: Manual Donations DB Error: constraint violation
January 30, 2010, 09:32:39 pm
Problem has been resolved with the installation of CiviCRM 3.1.1!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Manual Donations DB Error: constraint violation

This forum was archived on 2017-11-26.