1

The IPN information from Paypal is not being transferred to financial_item and financial_trxn tables. Therefore all contributions made through paypal standard are still showing as pending in the user record. I've searched the forums but can't find anything that will fix the issue. Any help appreciated - the admin is going in and manually changing status and adding IPN from Paypal reports. Running Joomla 3.6.5 with Civicrm 4.6.33 on Php 5.6. Log entry reads:


Dec 14 10:41:41  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )
    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_financial_item (transaction_date , contact_id , description , amount , currency , financial_account_id , status_id , entity_table , entity_id ) VALUES ( 20171214104141 ,  0 , 'Fee' ,  0.85 , 'USD' ,  5 ,  1 , 'civicrm_financial_trxn' ,  6111 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`jgsny_jgs258`.`civicrm_financial_item`, CONSTRAINT `FK_civicrm_financial_item_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_financial_item (transaction_date , contact_id , description , amount , currency , financial_account_id , status_id , entity_table , entity_id ) VALUES ( 20171214104141 ,  0 , 'Fee' ,  0.85 , 'USD' ,  5 ,  1 , 'civicrm_financial_trxn' ,  6111 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`jgsny_jgs258`.`civicrm_financial_item`, CONSTRAINT `FK_civicrm_financial_item_contact_id` FOREIGN KEY (`contact_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_financial_item (transaction_date , contact_id , description , amount , currency , financial_account_id , status_id , entity_table , entity_id ) VALUES ( 20171214104141 ,  0 , 'Fee' ,  0.85 , 'USD' ,  5 ,  1 , 'civicrm_financial_trxn' ,  6111 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`jgsny_jgs258`.`civicrm_financial_item`, CONSTRAINT `FK_civicrm_financial_item_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]
)


Dec 14 10:41:41  [info] $backTrace = #0 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO civicrm_financial_item (transaction_date , contact_id , descripti...")
#4 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-3, 16, (Array:2), "INSERT INTO civicrm_financial_item (transaction_date , contact_id , descripti...")
#5 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -3, NULL, NULL, "INSERT INTO civicrm_financial_item (transaction_date , contact_id , descripti...", "DB_Error", TRUE)
#6 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-3, NULL, NULL, NULL, "1452 ** Cannot add or update a child row: a foreign key constraint fails (`jg...")
#7 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_financial_item (transaction_date , contact_id , descripti...")
#9 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO civicrm_financial_item (transaction_date , contact_id , descripti...")
#10 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_financial_item (transaction_date , contact_id , descripti...")
#11 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(442): DB_DataObject->insert()
#12 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Financial/BAO/FinancialItem.php(159): CRM_Core_DAO->save()
#13 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/BAO/FinancialTrxn.php(413): CRM_Financial_BAO_FinancialItem::create((Array:10), NULL, (Array:1))
#14 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Contribute/BAO/Contribution.php(2979): CRM_Core_BAO_FinancialTrxn::recordFees((Array:30))
#15 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Payment/BaseIPN.php(774): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:30), NULL)
#16 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Payment/PayPalIPN.php(290): CRM_Core_Payment_BaseIPN->completeTransaction((Array:30), (Array:9), (Array:7), Object(CRM_Core_Transaction), FALSE)
#17 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Payment/PayPalIPN.php(349): CRM_Core_Payment_PayPalIPN->single((Array:30), (Array:9), (Array:7), FALSE, FALSE)
#18 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/extern/ipn.php(52): CRM_Core_Payment_PayPalIPN->main()
#19 {main}
0

Can you check what value is set for 'CIVICRM_DOMAIN_ID' in your civicrm.settings.php?

and also please check the output of below query after replacing CIVICRM_DOMAIN_ID value SELECT contact_id FROM civicrm_domain where id = [CIVICRM_DOMAIN_ID];

  • 'CIVICRM_DOMAIN_ID = 1. The result of the query is the default organization. That's the only row in the table civicrm_domain. – GrannyKat Dec 26 '17 at 18:38
  • Just noticed that 'version' in civicrm_domain = 4.6.32. In backend civi admin , version is 4.6.33. Did update of db structure fail and can it be changed manually in the civicrm_domain table? – GrannyKat Dec 26 '17 at 18:50
  • You can update through UI by running /civicrm/upgrade?reset=1 – Pradeep Nayak Dec 27 '17 at 5:36
  • Can you also please confirm 'CIVICRM_DOMAIN_ID = 1 is same in both civicrm.settings.php? i.e /administrator/components/com_civicrm and /components/com_civicrm. – Pradeep Nayak Dec 27 '17 at 5:39

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.