CRM-20750 follow up.
authoreileen <emcnaughton@wikimedia.org>
Mon, 11 Sep 2017 05:33:37 +0000 (17:33 +1200)
committereileen <emcnaughton@wikimedia.org>
Mon, 11 Sep 2017 05:33:37 +0000 (17:33 +1200)
Change logic for determinig paymentInstrumentChange to look at whether
['payment_instrument_id'] isset. If not it has not been passed by the calling
function and by definition the calling function is not attempting to change it

CRM/Contribute/BAO/Contribution.php

index 15c792e8aa926f8e8dcb0e42a27a0522f1faa40c..d71f0fc5ef58b7b9d6cebdafa2f80c8d01b97d5a 100644 (file)
@@ -5351,7 +5351,7 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
 
     if (array_key_exists('payment_instrument_id', $params)) {
       if (CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id) &&
-        !CRM_Utils_System::isNull($params['contribution']->payment_instrument_id)
+        !CRM_Utils_System::isNull($params['payment_instrument_id'])
       ) {
         //check if status is changed from Pending to Completed
         // do not update payment instrument changes for Pending to Completed
@@ -5361,7 +5361,7 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
           return TRUE;
         }
       }
-      elseif ((!CRM_Utils_System::isNull($params['contribution']->payment_instrument_id) ||
+      elseif ((!CRM_Utils_System::isNull($params['payment_instrument_id']) &&
           !CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id)) &&
         $params['contribution']->payment_instrument_id != $params['prevContribution']->payment_instrument_id
       ) {