Details
-
Type:
Bug
-
Status: Done/Fixed
-
Priority:
Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.2.2
-
Fix Version/s: 4.3.0
-
Component/s: CiviContribute, CiviCRM API
Description
When Contribution Import receives certain errors it isn't handling them but just proceeding forward, leading to a crash and un-helpful PEAR error message.
The problem is around line 81 of /civicrm/api/v3/Contribution.php in function civicrm_api3_contribution_create, and adding error handling code similar to this will fix the problem:
$contribution = CRM_Contribute_BAO_Contribution::create($values, $ids);
++ //Needs to check whether $contribution returned an error
++ if (isset($contribution->_errors)) return civicrm_api3_create_error($contribution->_errors[0]['message']);
if(!empty($params['use_default_price_set']) && empty($params['id'] )){
_civicrm_api3_contribution_createdefaultlineitem($params, $contribution);
Maybe that should just be something like if (isset($contribution->_errors)) return $contribution; but you guys can sort out that type of thing better than I.