Answers.Body: <p>OK, found it. For some reason the log table log_civicrm_financial_trxn did not have the card_type_id column, therefore the trigger that tried to log any action on the table threw an exception.
  Once I added the column manually to the log table, the problem was solved.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-13T21:31:09.703Z
Answers.Text: Ooh - that's a good catch!  I feel like a very similar bug was caught at almost the same time as this
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-13T17:13:17.467Z
Answers.LastActivityDate: 2017-08-13T17:13:17.467Z
Answers.UserDisplayName: Elad
Answers.Body: <p>This is the most important part of the error:</p>
  
  <pre><code>Unknown column 'card_type_id' in 'field list'
  </code></pre>
  
  <p>A feature added since 4.7.18 is the ability to store the type of credit card used during a credit card transaction.  So a new field <code>card_type_id</code> was created to store that data.</p>
  
  <p>Your copy of the database doesn't have this field.  </p>
  
  <p>I think the most likely explanation is that you upgraded CiviCRM's file system without visiting the page that upgrades the database.  From your backtrace, I can see you're running Drupal; please try visiting <code>http://&lt;your_drupal_home&gt;/civicrm/upgrade?reset=1</code> (reference: <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Upgrading+CiviCRM+for+Drupal+7" rel="nofollow noreferrer">Drupal upgrade instructions</a> step 11).</p>
  
  <p>The second possibility is that there's a bug in the upgrade script that prevented this field from being added - but this is the first I've heard of someone having this problem.  Please try to run the upgrade script again and see if it resolves your issue.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-13T16:42:14.683Z
Answers.Text: I did upgrade the database when I updated the file system, and my civicrm_financial_trxn table has the column 'card_type_id', with all null's and default value null as well.
  The weird thing is that the failed query doesn't even have this column in it. So I thought maybe in one of the triggers, but the only one for the insert is just inserting into the log table the old value of that column. Should not throw any exception.
Answers.UserDisplayName: Elad
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-12T19:36:59.797Z
Answers.LastActivityDate: 2017-08-12T19:36:59.797Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>After upgrading from 4.7.18 to 4.7.22 (maybe it has nothing to do with that) -</p>
  
  <p>I check out and pay via Paypal in an online registration page, I get redirected to the Thank You page, where I can review my info and click Confirm.
  After clicking confirm, I get an error saying: </p>
  
  <pre><code>DB Error: no such field
  
  Fatal error: Uncaught CRM_Core_Exception: [0: Transaction integrity error: Expected to find active frame thrown in /home/tamera/www/www/sites/all/modules/civicrm/Civi/Core/Transaction/Manager.php on line 107
  </code></pre>
  
  <p>The new registration is not listed then in Civi, the participant is not registered, nor the payment that he did, although the payment was already done (which creates a lot of problems with refunds and explanations).</p>
  
  <pre><code>And in the logs I can see these 3 messages in that moment:
  
  Notice: Undefined index: feeamt in CRM_Core_Payment_PayPalImpl-&gt;doExpressCheckout() (line 333 of /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
  
  $Fatal Error Details = Array ( [callback] =&gt; Array ( [0] =&gt; CRM_Core_Error [1] =&gt; handle ) [code] =&gt; -19 [message] =&gt; DB Error: no such field [mode] =&gt; 16 [debug_info] =&gt; INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list'] [type] =&gt; DB_Error [user_info] =&gt; INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list'] [to_string] =&gt; [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list']"] )
  
  $backTrace = 
  #0 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(229): CRM_Core_Error::backtrace("backTrace", TRUE) 
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error)) 
  #2 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error)) 
  #3 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error-&gt;__construct("DB Error: no such field", -19, 16, (Array:2), "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #4 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error-&gt;__construct(-19, 16, (Array:2), "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #5 [internal function](): PEAR-&gt;_raiseError(Object(DB_mysqli), NULL, -19, NULL, NULL, "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...", "DB_Error", TRUE) 
  #6 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8)) 
  #7 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR-&gt;__call("raiseError", (Array:7)) 
  #8 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR-&gt;raiseError(NULL, -19, NULL, NULL, "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...", "DB_Error", TRUE) 
  #9 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common-&gt;raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'card_type_id' in 'field list'") 
  #10 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli-&gt;mysqliRaiseError() 
  #11 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli-&gt;simpleQuery("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")         
  #12 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common-&gt;query("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #13 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1068): DB_DataObject-&gt;_query("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #14 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(495): DB_DataObject-&gt;insert() 
  #15 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/BAO/FinancialTrxn.php(66): CRM_Core_DAO-&gt;save() 
  #16 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(3451): CRM_Core_BAO_FinancialTrxn::create((Array:15)) 
  #17 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(234): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:28)) 
  #18 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(1043): CRM_Contribute_BAO_Contribution::add((Array:28), (Array:0)) 
  #19 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(611): CRM_Event_Form_Registration_Confirm::processContribution(Object(CRM_Event_Form_Registration_Confirm), (Array:57), (Array:56), "122808", FALSE, FALSE, (Array:23)) 
  #20 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(447): CRM_Event_Form_Registration_Confirm-&gt;postProcess() 
  #21 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form-&gt;mainProcess() 
  #22 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine-&gt;perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next") 
  #23 /home/tamera/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next-&gt;perform(Object(CRM_Event_Form_Registration_Confirm), "next") 
  #24 /home/tamera/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Event_Form_Registration_Confirm), "next") 
  #25 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page-&gt;handle("next") 
  #26 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(310): CRM_Core_Controller-&gt;run((Array:3), NULL) 
  #27 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15)) 
  #28 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3)) 
  #29 /home/tamera/www/www/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3)) 
  #30 [internal function](): civicrm_invoke("event", "register") 
  #31 /home/tamera/www/www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2)) 
  #32 /home/tamera/www/www/index.php(21): menu_execute_active_handler() 
  #33 {main}
  </code></pre>
  
Tags: <civievent><online-registration><payment>
Title: Online Registration Confirmation throws an error after Paypal checkout is done
ThreadText: # Online Registration Confirmation throws an error after Paypal checkout is done
  
  (Asked by: username_0 on 2017-08-12)
  
  After upgrading from 4.7.18 to 4.7.22 (maybe it has nothing to do with that) -
  I check out and pay via Paypal in an online registration page, I get redirected to the Thank You page, where I can review my info and click Confirm.
  After clicking confirm, I get an error saying: 
  DB Error: no such field
  
  Fatal error: Uncaught CRM_Core_Exception: [0: Transaction integrity error: Expected to find active frame thrown in /home/tamera/www/www/sites/all/modules/civicrm/Civi/Core/Transaction/Manager.php on line 107
  
  The new registration is not listed then in Civi, the participant is not registered, nor the payment that he did, although the payment was already done (which creates a lot of problems with refunds and explanations).
  And in the logs I can see these 3 messages in that moment:
  
  Notice: Undefined index: feeamt in CRM_Core_Payment_PayPalImpl->doExpressCheckout() (line 333 of /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Payment/PayPalImpl.php).
  
  $Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle ) [code] => -19 [message] => DB Error: no such field [mode] => 16 [debug_info] => INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list'] [type] => DB_Error [user_info] => INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list'] [to_string] => [db_error: message="DB Error: no such field" code=-19 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , total_amount , fee_amount , net_amount , currency , is_payment , trxn_id , status_id , payment_processor_id , payment_instrument_id , check_number ) VALUES ( 12 , 20170812110912 , 240 , 0 , 240 , 'EUR' , 1 , '9YB45647LC580693G' , 1 , 4 , 1 , NULL ) [nativecode=1054 ** Unknown column 'card_type_id' in 'field list']"] )
  
  $backTrace = 
  #0 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Error.php(229): CRM_Core_Error::backtrace("backTrace", TRUE) 
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error)) 
  #2 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error)) 
  #3 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: no such field", -19, 16, (Array:2), "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #4 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-19, 16, (Array:2), "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -19, NULL, NULL, "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...", "DB_Error", TRUE) 
  #6 /home/tamera/www/www/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8)) 
  #7 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7)) 
  #8 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -19, NULL, NULL, "INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...", "DB_Error", TRUE) 
  #9 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-19, NULL, NULL, NULL, "1054 ** Unknown column 'card_type_id' in 'field list'") 
  #10 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError() 
  #11 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...")         
  #12 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #13 /home/tamera/www/www/sites/all/modules/civicrm/packages/DB/DataObject.php(1068): DB_DataObject->_query("INSERT INTO civicrm_financial_trxn (to_financial_account_id , trxn_date , tot...") 
  #14 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/DAO.php(495): DB_DataObject->insert() 
  #15 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/BAO/FinancialTrxn.php(66): CRM_Core_DAO->save() 
  #16 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(3451): CRM_Core_BAO_FinancialTrxn::create((Array:15)) 
  #17 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php(234): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:28)) 
  #18 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(1043): CRM_Contribute_BAO_Contribution::add((Array:28), (Array:0)) 
  #19 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Event/Form/Registration/Confirm.php(611): CRM_Event_Form_Registration_Confirm::processContribution(Object(CRM_Event_Form_Registration_Confirm), (Array:57), (Array:56), "122808", FALSE, FALSE, (Array:23)) 
  #20 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Form.php(447): CRM_Event_Form_Registration_Confirm->postProcess() 
  #21 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess() 
  #22 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next") 
  #23 /home/tamera/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next") 
  #24 /home/tamera/www/www/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next") 
  #25 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next") 
  #26 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(310): CRM_Core_Controller->run((Array:3), NULL) 
  #27 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:15)) 
  #28 /home/tamera/www/www/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3)) 
  #29 /home/tamera/www/www/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3)) 
  #30 [internal function](): civicrm_invoke("event", "register") 
  #31 /home/tamera/www/www/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2)) 
  #32 /home/tamera/www/www/index.php(21): menu_execute_active_handler() 
  #33 {main}
  
  **Tags:** civievent, online-registration, payment
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-08-13. Score: 1
  
  OK, found it. For some reason the log table log\_civicrm\_financial\_trxn did not have the card\_type\_id column, therefore the trigger that tried to log any action on the table threw an exception.
  Once I added the column manually to the log table, the problem was solved.
  
  > **Comments:**
  > **username_1**: Ooh - that's a good catch!  I feel like a very similar bug was caught at almost the same time as this  
  
  ---
  
  ### Answer by username_1 on 2017-08-12. Score: 1
  
  This is the most important part of the error:
  Unknown column 'card_type_id' in 'field list'
  
  A feature added since 4.7.18 is the ability to store the type of credit card used during a credit card transaction.  So a new field card_type_id was created to store that data.
  Your copy of the database doesn't have this field.  
  I think the most likely explanation is that you upgraded CiviCRM's file system without visiting the page that upgrades the database.  From your backtrace, I can see you're running Drupal; please try visiting http:///civicrm/upgrade?reset=1 (reference: Drupal upgrade instructions step 11).
  The second possibility is that there's a bug in the upgrade script that prevented this field from being added - but this is the first I've heard of someone having this problem.  Please try to run the upgrade script again and see if it resolves your issue.
  
  > **Comments:**
  > **username_0**: I did upgrade the database when I updated the file system, and my civicrm_financial_trxn table has the column 'card_type_id', with all null's and default value null as well. The weird thing is that the failed query doesn't even have this column in it. So I thought maybe in one of the triggers, but the only one for the insert is just inserting into the log table the old value of that column. Should not throw any exception.  
  
  ---
  
  