Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Critical
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.8, 4.3.0
-
Fix Version/s: 4.3.0
-
Component/s: Accounting Integration, CiviContribute
-
Labels:None
Description
Fatal error inserting line_item for online contribution (error details attached) if the contribution page is configured as follows:
Amounts tab
- Test (dummy) processor
- Contribution Amounts section enabled TRUE
- Allow other amounts TRUE
- no Fixed Contribution Amounts defined
Membership tab
- Require Membership Signup FALSE
- Separate Membership Payment FALSE
... and user does online contribution and says "No Thank You" for membership, and only fills in Additional Contribution amount.
(see attachment 12018_4.2.txt for fatal error details on this)
===
If I then add a few Fixed Contribution Amounts to the same online contribution page, and try again - I get this fatal:
INSERT INTO civicrm_line_item (entity_table , entity_id , unit_price , line_total ) VALUES ('civicrm_contribution' , 101 , 500 , 500 ) [nativecode=1364 ** Field 'qty' doesn't have a default value]
Backtrace:
#13 /Users/dgg/git/crm_v4.3/CRM/Price/BAO/LineItem.php(291): CRM_Price_BAO_LineItem::create((Array:4))
#14 /Users/dgg/git/crm_v4.3/CRM/Contribute/BAO/Contribution.php(2770): CRM_Price_BAO_LineItem::processPriceSet(101, (Array:1), Object(CRM_Contribute_BAO_Contribution), "civicrm_contribution", FALSE)
#15 /Users/dgg/git/crm_v4.3/CRM/Contribute/BAO/Contribution.php(178): CRM_Contribute_BAO_Contribution::recordFinancialAccounts((Array:31), (Array:0))
#16 /Users/dgg/git/crm_v4.3/CRM/Contribute/Form/Contribution/Confirm.php(1281): CRM_Contribute_BAO_Contribution::add((Array:31), (Array:0))
#17 /Users/dgg/git/crm_v4.3/CRM/Contribute/BAO/Contribution/Utils.php(292): CRM_Contribute_Form_Contribution_Confirm::processContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:52), (Array:51), "202", Object(CRM_Financial_DAO_FinancialType), TRUE, FALSE, TRUE)
#18 /Users/dgg/git/crm_v4.3/CRM/Contribute/Form/Contribution/Confirm.php(939): CRM_Contribute_BAO_Contribution_Utils::processConfirm(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:51), (Array:37), "202", "1", "contribution", (Array:0))
#19 /Users/dgg/git/crm_v4.3/CRM/Core/Form.php(246): CRM_Contribute_Form_Contribution_Confirm->postProcess()
#
— Original Post —
to reproduce:
create a contribution page.
enable "other amount" option.
enable membership options (may not be necessary).
complete the form, selecting "no thanks" for membership options and entering an amount in the other field.
on submit, you receive an FK constraint error on the civicrm_line_item table
I think what's happening is that we're not creating the necessary hidden priceset line item for the other amount field. the breakdown occurs in:
civicrm/CRM/Price/BAO/LineItem.php(65): CRM_Core_DAO->save()
this is reproducible in both 4.2 and 4.3
http://sandbox.drupal.civicrm.org/civicrm/contribute/transact?reset=1&id=4
http://drupal.demo.civicrm.org/civicrm/contribute/transact?reset=1&id=6