CRM-17751 add extra check to prevent error
authoreileenmcnaugton <eileen@fuzion.co.nz>
Tue, 16 Feb 2016 08:29:26 +0000 (21:29 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Tue, 16 Feb 2016 08:29:26 +0000 (21:29 +1300)
It turns out the refund_trxn_id can be set erroneously - this might be a form issue - but we also want to avoid an error here

CRM/Contribute/BAO/Contribution.php

index 8cd3e5d15cedd03b88fac0f610f14e8773ee9382..5e630c3e09ab3c97a8aac7f69f91eb070500ae7e 100644 (file)
@@ -3285,7 +3285,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
           // CRM-17751.
           if (isset($params['refund_trxn_id'])) {
             $refundIDs = CRM_Core_BAO_FinancialTrxn::getRefundTransactionIDs($params['id']);
-            if ($refundIDs['trxn_id'] != $params['refund_trxn_id']) {
+            if (!empty($refundIDs['financialTrxnId']) && $refundIDs['trxn_id'] != $params['refund_trxn_id']) {
               civicrm_api3('FinancialTrxn', 'create', array('id' => $refundIDs['financialTrxnId'], 'trxn_id' => $params['refund_trxn_id']));
             }
           }