Answers.Body: <p>Can you check what value is set for 'CIVICRM_DOMAIN_ID' in your civicrm.settings.php?</p>
  
  <p>and also please check the output of below query after replacing CIVICRM_DOMAIN_ID value
  <code>SELECT contact_id FROM civicrm_domain where id = [CIVICRM_DOMAIN_ID];</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-26T18:38:39.930Z
Answers.Text: 'CIVICRM_DOMAIN_ID = 1. The result of the query is the default organization. That's the only row in the table civicrm_domain.
Answers.UserDisplayName: GrannyKat
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-26T18:50:34.083Z
Answers.Text: 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?
Answers.UserDisplayName: GrannyKat
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-27T05:36:48.020Z
Answers.Text: You can update through UI by running /civicrm/upgrade?reset=1
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-27T05:39:11.130Z
Answers.Text: 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.
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-26T12:58:15.727Z
Answers.LastActivityDate: 2017-12-26T12:58:15.727Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>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:</p>
  
  <hr>
  
  <pre><code>Dec 14 10:41:41  [info] $Fatal Error Details = Array
  (
      [callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; handle
          )
      [code] =&gt; -3
      [message] =&gt; DB Error: constraint violation
      [mode] =&gt; 16
      [debug_info] =&gt; 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] =&gt; DB_Error
      [user_info] =&gt; 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] =&gt; [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-&gt;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-&gt;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-&gt;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-&gt;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-&gt;mysqlRaiseError()
  #8 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql-&gt;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-&gt;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-&gt;_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-&gt;insert()
  #12 /home/jgsny/public_html/administrator/components/com_civicrm/civicrm/CRM/Financial/BAO/FinancialItem.php(159): CRM_Core_DAO-&gt;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-&gt;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-&gt;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-&gt;main()
  #19 {main}
  </code></pre>
  
Tags: <joomla><paypal>
Title: civicrm_financial_item fails on update transaction
ThreadText: # civicrm_financial_item fails on update transaction
  
  (Asked by: username_0 on 2017-12-14)
  
  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}
  
  **Tags:** joomla, paypal
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-12-26. Score: 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];`
  
  > **Comments:**
  > **username_0**: 'CIVICRM_DOMAIN_ID = 1. The result of the query is the default organization. That's the only row in the table civicrm_domain.  
  > **username_0**: 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?  
  > **username_1**: You can update through UI by running /civicrm/upgrade?reset=1  
  > **username_1**: 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.  
  
  ---
  
  