Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.4.7, 4.0.7
-
Component/s: CiviContribute
-
Labels:None
Description
Fatal error when saving an existing contribution record - only occurs if civicrm_membership table is empty. The code in CRM_Contribute_BAO_Contribution::transitionComponents (lines 1388-1405) is "mistakenly" looking for an associated membership record. I think part of the problem is that the 'membership' item in $componentDetails is an empty array in this case (due to price sets change). This would have been a null value previously.
$ids['membership'] = CRM_Utils_Array::value( 'membership', $componentDetails );
To recreate - delete all membership records. Then edit any existing contribution record - you'll get the fatal error. You can make the error go away by creating a membership record FOR ANY CONTACT (does not need to belong to the contact whose contribution record you've been editing). This indicates that the code which is "looking for" a related membership record is NOT doing the right thing at all.
1. Should not be trying to transition a membership record when there isn't one linked to THIS contribution.
2. Should not fix the problem simply because some random membership record exists in the DB
Backtrace example
=================
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 296
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php, fatal, 1404
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php, transitionComponents, 1612
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php, updateRelatedComponent, 1507
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 250
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, mainProcess, 153
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php, realPerform, 130
/home/hectorme/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
/home/hectorme/public_html/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 284
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php, run, 207
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php, edit, 261
/home/hectorme/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 223
/home/hectorme/public_html/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 347
, civicrm_invoke,
/home/hectorme/public_html/includes/menu.inc, call_user_func_array, 349
/home/hectorme/public_html/index.php, menu_execute_active_handler, 17
Modify message
Report