CRM-12559
authorDonald A. Lobo <lobo@civicrm.org>
Thu, 9 May 2013 20:15:51 +0000 (13:15 -0700)
committerDonald A. Lobo <lobo@civicrm.org>
Thu, 9 May 2013 20:15:51 +0000 (13:15 -0700)
----------------------------------------
* CRM-12559: Handle failed contributions in CRM_Contribute_BAO_Contribution_Confirm::processContribution()
  http://issues.civicrm.org/jira/browse/CRM-12559

CRM/Contribute/Form/Contribution/Confirm.php

index 6e3af38f578a778549499ba6fb00bb3906f6d1be..6ba8345fb4ee9b5c8dd6dda66730927ab3033c47 100644 (file)
@@ -1303,6 +1303,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $contribParams['line_item'] = $form->_lineItem;
       //add contribution record
       $contribution = CRM_Contribute_BAO_Contribution::add($contribParams, $ids);
+      if (is_a($contribution, 'CRM_Core_Error')) {
+        $message = CRM_Core_Error::getMessages($contribution);
+        CRM_Core_Error::fatal($message);
+      }
     }
 
     // process soft credit / pcp pages
@@ -1447,7 +1451,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
 
     // create an activity record
     if ($contribution) {
-    CRM_Activity_BAO_Activity::addActivity($contribution, NULL, $targetContactID);
+      CRM_Activity_BAO_Activity::addActivity($contribution, NULL, $targetContactID);
     }
 
     $transaction->commit();