Body: <p>I'm getting an error screen when I try to add a donation to a constituent's record.  I've pasted the error below.  I think it comes down to <code>Field 'amount_level' doesn't have a default value</code> for the <code>civicrm_contribution</code> table.  Can someone please tell me what the default value is supposed to be?  Or should that field allow null?</p>
  <p>Should I report this as a bug?</p>
  <p>Thanks,
  Richard</p>
  <pre><code>Error Field Error Value
  Type    DB_Error
  Code    -1
  Message DB Error: unknown error
  Mode    16
  UserInfo    INSERT INTO `civicrm_contribution` (`contact_id` , `financial_type_id` , `contribution_page_id` , `payment_instrument_id` , `receive_date` , `non_deductible_amount` , `total_amount` , `fee_amount` , `net_amount` , `trxn_id` , `invoice_id` , `currency` , `cancel_date` , `cancel_reason` , `receipt_date` , `thankyou_date` , `source` , `is_pay_later` , `contribution_status_id` , `check_number` , `creditnote_id` , `tax_amount` ) VALUES ( 5536 , 3 , NULL , 4 , 20220614171300 , 0.00 , 1000 , 0 , 1000 , NULL , NULL , 'USD' , NULL , NULL , NULL , 20220615000000 , NULL , 0 , 1 , NULL , NULL , 0 ) [nativecode=1364 ** Field 'amount_level' doesn't have a default value]
  DebugInfo   INSERT INTO `civicrm_contribution` (`contact_id` , `financial_type_id` , `contribution_page_id` , `payment_instrument_id` , `receive_date` , `non_deductible_amount` , `total_amount` , `fee_amount` , `net_amount` , `trxn_id` , `invoice_id` , `currency` , `cancel_date` , `cancel_reason` , `receipt_date` , `thankyou_date` , `source` , `is_pay_later` , `contribution_status_id` , `check_number` , `creditnote_id` , `tax_amount` ) VALUES ( 5536 , 3 , NULL , 4 , 20220614171300 , 0.00 , 1000 , 0 , 1000 , NULL , NULL , 'USD' , NULL , NULL , NULL , 20220615000000 , NULL , 0 , 1 , NULL , NULL , 0 ) [nativecode=1364 ** Field 'amount_level' doesn't have a default value]
  PEAR_Exception: DB Error: unknown error in /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922
  - DB_Error: DB Error: unknown error in unknown on line unknown
  Exception trace
  #   Function    Location
  0   CRM_Core_Error::exceptionHandler()  /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922
  1   PEAR_Error-&gt;__construct()   /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php:997
  2   DB_Error-&gt;__construct() /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575
  3   PEAR::_raiseError() /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223
  4   PEAR-&gt;__call()  /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1928
  5   DB_common-&gt;raiseError() /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:936
  6   DB_mysqli-&gt;mysqliRaiseError()   /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:406
  7   DB_mysqli-&gt;simpleQuery()    /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1234
  8   DB_common-&gt;query()  /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:2696
  9   DB_DataObject-&gt;_query() /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:1245
  10  DB_DataObject-&gt;insert() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php:660
  11  CRM_Core_DAO-&gt;save()    /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution.php:202
  12  CRM_Contribute_BAO_Contribution::add()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution.php:484
  13  CRM_Contribute_BAO_Contribution::create()   /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution.php:1786
  14  CRM_Contribute_Form_Contribution-&gt;submit()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution.php:948
  15  CRM_Contribute_Form_Contribution-&gt;postProcess() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:573
  16  CRM_Core_Form-&gt;mainProcess()    /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:152
  17  CRM_Core_QuickForm_Action_Upload-&gt;realPerform() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:119
  18  CRM_Core_QuickForm_Action_Upload-&gt;perform() /var/www/html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203
  19  HTML_QuickForm_Controller-&gt;handle() /var/www/html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103
  20  HTML_QuickForm_Page-&gt;handle()   /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:355
  21  CRM_Core_Controller-&gt;run()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Page/Tab.php:409
  22  CRM_Contribute_Page_Tab-&gt;edit() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Page/Tab.php:465
  23  CRM_Contribute_Page_Tab-&gt;run()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319
  24  CRM_Core_Invoke::runItem()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69
  25  CRM_Core_Invoke::_invoke()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
  26  CRM_Core_Invoke::invoke()   /var/www/html/wp-content/plugins/civicrm/civicrm.php:1199
  27  CiviCRM_For_WordPress-&gt;invoke() /var/www/html/wp-includes/class-wp-hook.php:307
  28  WP_Hook-&gt;apply_filters()    /var/www/html/wp-includes/class-wp-hook.php:331
  29  WP_Hook-&gt;do_action()    /var/www/html/wp-includes/plugin.php:476
  30  do_action() /var/www/html/wp-admin/admin.php:259
  31  {main}   
  Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
  DB Error: unknown error
  
  Return to home page.
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-21T11:17:58.807Z
Comments.Text: How are you trying to add the data?  Which form?  What version?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-06-21T19:28:50.287Z
Comments.Text: CiviCRM version 5.50.3.  I get the error when I go to Contributions -> New Contrubition
Comments.UserDisplayName: Richard Ellwood
Tags: <civicontribute><database>
Title: Database error when attempting to add a contribution to a constituent's record
ThreadText: # Database error when attempting to add a contribution to a constituent's record
  
  (Asked by: username_0 on 2022-06-20)
  
  I'm getting an error screen when I try to add a donation to a constituent's record.  I've pasted the error below.  I think it comes down to Field 'amount_level' doesn't have a default value for the civicrm_contribution table.  Can someone please tell me what the default value is supposed to be?  Or should that field allow null?
  Should I report this as a bug?
  Thanks,
  Richard
  Error Field Error Value
  Type    DB_Error
  Code    -1
  Message DB Error: unknown error
  Mode    16
  UserInfo    INSERT INTO `civicrm_contribution` (`contact_id` , `financial_type_id` , `contribution_page_id` , `payment_instrument_id` , `receive_date` , `non_deductible_amount` , `total_amount` , `fee_amount` , `net_amount` , `trxn_id` , `invoice_id` , `currency` , `cancel_date` , `cancel_reason` , `receipt_date` , `thankyou_date` , `source` , `is_pay_later` , `contribution_status_id` , `check_number` , `creditnote_id` , `tax_amount` ) VALUES ( 5536 , 3 , NULL , 4 , 20220614171300 , 0.00 , 1000 , 0 , 1000 , NULL , NULL , 'USD' , NULL , NULL , NULL , 20220615000000 , NULL , 0 , 1 , NULL , NULL , 0 ) [nativecode=1364 ** Field 'amount_level' doesn't have a default value]
  DebugInfo   INSERT INTO `civicrm_contribution` (`contact_id` , `financial_type_id` , `contribution_page_id` , `payment_instrument_id` , `receive_date` , `non_deductible_amount` , `total_amount` , `fee_amount` , `net_amount` , `trxn_id` , `invoice_id` , `currency` , `cancel_date` , `cancel_reason` , `receipt_date` , `thankyou_date` , `source` , `is_pay_later` , `contribution_status_id` , `check_number` , `creditnote_id` , `tax_amount` ) VALUES ( 5536 , 3 , NULL , 4 , 20220614171300 , 0.00 , 1000 , 0 , 1000 , NULL , NULL , 'USD' , NULL , NULL , NULL , 20220615000000 , NULL , 0 , 1 , NULL , NULL , 0 ) [nativecode=1364 ** Field 'amount_level' doesn't have a default value]
  PEAR_Exception: DB Error: unknown error in /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php on line 922
  - DB_Error: DB Error: unknown error in unknown on line unknown
  Exception trace
  #   Function    Location
  0   CRM_Core_Error::exceptionHandler()  /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:922
  1   PEAR_Error->__construct()   /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php:997
  2   DB_Error->__construct() /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:575
  3   PEAR::_raiseError() /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php:223
  4   PEAR->__call()  /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1928
  5   DB_common->raiseError() /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:936
  6   DB_mysqli->mysqliRaiseError()   /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:406
  7   DB_mysqli->simpleQuery()    /var/www/html/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php:1234
  8   DB_common->query()  /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:2696
  9   DB_DataObject->_query() /var/www/html/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php:1245
  10  DB_DataObject->insert() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php:660
  11  CRM_Core_DAO->save()    /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution.php:202
  12  CRM_Contribute_BAO_Contribution::add()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/BAO/Contribution.php:484
  13  CRM_Contribute_BAO_Contribution::create()   /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution.php:1786
  14  CRM_Contribute_Form_Contribution->submit()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Form/Contribution.php:948
  15  CRM_Contribute_Form_Contribution->postProcess() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php:573
  16  CRM_Core_Form->mainProcess()    /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:152
  17  CRM_Core_QuickForm_Action_Upload->realPerform() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Upload.php:119
  18  CRM_Core_QuickForm_Action_Upload->perform() /var/www/html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203
  19  HTML_QuickForm_Controller->handle() /var/www/html/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php:103
  20  HTML_QuickForm_Page->handle()   /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php:355
  21  CRM_Core_Controller->run()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Page/Tab.php:409
  22  CRM_Contribute_Page_Tab->edit() /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Contribute/Page/Tab.php:465
  23  CRM_Contribute_Page_Tab->run()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:319
  24  CRM_Core_Invoke::runItem()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:69
  25  CRM_Core_Invoke::_invoke()  /var/www/html/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php:36
  26  CRM_Core_Invoke::invoke()   /var/www/html/wp-content/plugins/civicrm/civicrm.php:1199
  27  CiviCRM_For_WordPress->invoke() /var/www/html/wp-includes/class-wp-hook.php:307
  28  WP_Hook->apply_filters()    /var/www/html/wp-includes/class-wp-hook.php:331
  29  WP_Hook->do_action()    /var/www/html/wp-includes/plugin.php:476
  30  do_action() /var/www/html/wp-admin/admin.php:259
  31  {main}   
  Sorry, due to an error, we are unable to fulfill your request at the moment. You may want to contact your administrator or service provider with more details about what action you were performing when this occurred.
  DB Error: unknown error
  
  Return to home page.
  
  **Tags:** civicontribute, database
  
  > **Comments:**
  > **username_1**: How are you trying to add the data?  Which form?  What version?  
  > **username_0**: CiviCRM version 5.50.3.  I get the error when I go to Contributions -> New Contrubition  
  
  ---
  
  ## 0 answers
  
  