From: eileenmcnaugton Date: Mon, 3 Aug 2015 12:39:08 +0000 (+1200) Subject: CRM-16926 fix up patch for 4.7 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d3bba6a7d37beacfb3ece1c780f25ec1f29574e3;p=civicrm-core.git CRM-16926 fix up patch for 4.7 --- diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index a8e4da5e0d..23e4bc5e30 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -2307,12 +2307,21 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr // @todo move premium processing to complete transaction if it truly is an 'after' action. $this->postProcessPremium($premiumParams, $result['contribution']); if (CRM_Utils_Array::value('payment_status_id', $result) == 1) { - civicrm_api3('contribution', 'completetransaction', array( - 'id' => $result['contribution']->id, - 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), - 'payment_processor_id' => $this->_paymentProcessor['id'], - ) - ); + try { + civicrm_api3('contribution', 'completetransaction', array( + 'id' => $result['contribution']->id, + 'trxn_id' => CRM_Utils_Array::value('trxn_id', $result), + 'payment_processor_id' => $this->_paymentProcessor['id'], + 'is_transactional' => FALSE, + ) + ); + } + catch (CiviCRM_API3_Exception $e) { + if ($e->getErrorCode() != 'contribution_completed') { + throw new CRM_Core_Exception('Failed to update contribution in database'); + } + } + } return $result; }