Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.1
-
Fix Version/s: 4.2.3
-
Component/s: CiviContribute
-
Labels:None
Description
The fatal error below is thrown whenever you try to edit a contribution record that is linked to a participant registration from the Contributions tab or any contribution selector (e.g. from a URL like this: civicrm/contact/view/contribution?reset=1&action=update&id=18&cid=24&context=contribution)
You can edit the same contribution successfully if you edit it via the contribution 'Edit' link provided in Participant Edit or Participant View screens. In this case the edit URL is: civicrm/contact/view/contribution?reset=1&action=update&id=18&cid=24&context=participant&compId=31&compAction=2
The difference is that the second URL provides linkage to the associated participant record using the 'compId' parameter.
The code that needs to be fixed is in CRM_Contribute_Form_Contribution->postProcess() in lines 1154 - 1165 (see below). For the "broken" use case, we're setting $entityTable to 'contribution' and $entityID to the contribution ID. However, the line_item we're trying to retrieve in line 1177 actually carries 'civicrm_participant' and the participant ID - which causes line 1167 to return an empty array and eventually results in the fatal error on line 1177
if ($this->_context == 'participant' && $this->_compId)
{ $entityTable = 'participant'; $entityID = $this->_compId; $participantParams = array( 'fee_amount' => $submittedValues['total_amount'], 'id' => $entityID); CRM_Event_BAO_Participant::add($participantParams); }else
{ $entityTable = 'contribution'; $entityID = $this->_id; }We need add code which will distinguish contributions which are linked to participant fees regardless of the whether compId or context is present in the URL. I think this probably means checking civicrm_participant_payment table to see if the contribution we're editing is linked to a participant. Should be a BAO function to do this.
— Original Post ----
I seem to be having the problem described here: http://issues.civicrm.org/jira/browse/CRM-10812. I am using 4.2.2, and did not import my records. Attempting to edit (but not create) contribution records brings up a screen with the following:
Sorry but we are not able to provide this at the moment.
We experienced an unexpected error. Please post a detailed description and the backtrace on the CiviCRM forums: http://forum.civicrm.org/
Logs reveal the following:
Notice: Undefined index: price_field_id in CRM_Contribute_Form_Contribution->postProcess() (line 1177 of /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php).
$Fatal Error Details = Array ( [message] => We experienced an unexpected error. Please post a detailed description and the backtrace on the CiviCRM forums: http://forum.civicrm.org/ [code] => )
$backTrace = #0 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/Error.php(300): CRM_Core_Error::backtrace("backTrace", TRUE) #1 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/DAO.php(755): CRM_Core_Error::fatal() #2 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution.php(1177): CRM_Core_DAO::getFieldValue("CRM_Price_DAO_Field", NULL, "price_set_id") #3 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/Form.php(246): CRM_Contribute_Form_Contribution->postProcess() #4 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(151): CRM_Core_Form->mainProcess() #5 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Upload.php(128): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Contribute_Form_Contribution), "upload") #6 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contribute_Form_Contribution), "upload") #7 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution), "upload") #8 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/Controller.php(289): HTML_QuickForm_Page->handle("upload") #9 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php(296): CRM_Core_Controller->run() #10 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Contribute/Page/Tab.php(353): CRM_Contribute_Page_Tab->edit() #11 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/CRM/Core/Invoke.php(228): CRM_Contribute_Page_Tab->run((Array:4), NULL) #12 /home/eros/public_html/hedone.us/public/sites/all/modules/civicrm/drupal/civicrm.module(500): CRM_Core_Invoke::invoke((Array:4)) #13 [internal function](): civicrm_invoke("contact", "view", "contribution") #14 /home/eros/public_html/hedone.us/public/includes/menu.inc(516): call_user_func_array("civicrm_invoke", (Array:3)) #15 /home/eros/public_html/hedone.us/public/index.php(21): menu_execute_active_handler() #16
{main}