Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.2
-
Fix Version/s: 4.6.3
-
Component/s: None
-
Labels:None
-
Documentation Required?:None
Description
I just debugged a contribution page that was getting a fatal error when people submitted the contribution page. The error turned out to be that the page used price sets but had a membership block configured - due to a page being converted to use a price set at some page - it was tripping up on:
// CRM-14354: For an auto-renewing membership with an additional contribution,
// if separate payments is not enabled, make sure only the membership fee recurs
if (!empty($form->_membershipBlock)
&& $form->_membershipBlock['is_separate_payment'] === '0'
&& isset($params['selectMembership'])
&& $form->_values['is_allow_other_amount'] == '1'
)
I tried deleting the membership block but although that worked in testing the config page then looked wrong (ie appeared not to have a membership block). Setting the value of is_separate_payment to 1 also seemed wrong but appeared to work.
I have a small fix that just checks for the min_fee to not be null - which appears to be always the case when membership_block is not actually active.
$backTrace =
#0 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_contribution_recur (contact_id , currency , frequency_uni...")
#4 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "INSERT INTO civicrm_contribution_recur (contact_id , currency , frequency_uni...")
#5 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "INSERT INTO civicrm_contribution_recur (contact_id , currency , frequency_uni...", "DB_Error", TRUE)
#6 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(1, NULL, NULL, NULL, "1364 ** Field 'amount' doesn't have a default value") #7 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql>mysqlRaiseError()
#8 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_contribution_recur (contact_id , currency , frequency_uni...")
#9 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO civicrm_contribution_recur (contact_id , currency , frequency_uni...")
#10 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_contribution_recur (contact_id , currency , frequency_uni...") #11 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/DAO.php(450): DB_DataObject->insert()
#12 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Contribute/BAO/ContributionRecur.php(94): CRM_Core_DAO->save()
#13 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1601): CRM_Contribute_BAO_ContributionRecur::add((Array:19))
#14 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1256): CRM_Contribute_Form_Contribution_Confirm::processRecurringContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:64), "43", Object(CRM_Financial_DAO_FinancialType), TRUE)
#15 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution/Utils.php(241): CRM_Contribute_Form_Contribution_Confirm::processContribution(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:64), NULL, "43", Object(CRM_Financial_DAO_FinancialType), TRUE, TRUE, FALSE, (Array:1))
#16 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(1338): CRM_Contribute_BAO_Contribution_Utils::processConfirm(Object(CRM_Contribute_Form_Contribution_Confirm), (Array:64), (Array:46), "43", "2", "membership", (Array:0), FALSE, 0)
#17 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1903): CRM_Member_BAO_Membership::postProcessMembership((Array:58), "43", Object(CRM_Contribute_Form_Contribution_Confirm), (Array:46), (Array:0), (Array:0), (Array:11), (Array:1), TRUE, NULL, FALSE, "2", (Array:0), 0)
#18 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Confirm.php(1019): CRM_Contribute_Form_Contribution_Confirm->processMembership((Array:58), "43", (Array:0), (Array:0), (Array:46), (Array:0), 0)
#19 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/Form.php(345): CRM_Contribute_Form_Contribution_Confirm->postProcess()
#20 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/StateMachine.php(164): CRM_Core_Form->mainProcess()
#21 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next", "Next") #22 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
#23 /var/www/site/my.site.org/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Confirm), "next") #24 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("next")
#25 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL)
#26 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
#27 /var/www/site/my.site.org/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#28 /var/www/site/my.site.org/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3)) #29 [internal function](): civicrm_invoke("contribute", "transact") #30 /var/www/site/my.site.org/includes/menu.inc(519): call_user_func_array("civicrm_invoke", (Array:2)) #31 /var/www/site/my.site.org/index.php(21): menu_execute_active_handler() #32