CRM-15555 declare processor_type before calling singleton
authorEileen McNaughton <eileen@fuzion.co.nz>
Sun, 9 Nov 2014 23:13:20 +0000 (12:13 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Thu, 13 Nov 2014 15:04:41 +0000 (04:04 +1300)
CRM/Contribute/Form/AdditionalPayment.php
CRM/Financial/BAO/PaymentProcessor.php
bin/ContributionProcessor.php

index f70f9cddc007df41ed58560735dca2d8142e192c..b0bd6d70360db593278365bb3f7d76e327dde661 100644 (file)
@@ -138,9 +138,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
 
     list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactId);
 
-    if (!$this->_refund) {
-      $this->assignPaymentRelatedVariables();
-    }
+    $this->assignPaymentRelatedVariables();
 
     $this->assign('contributionMode', $this->_mode);
     $this->assign('contactId', $this->_contactId);
@@ -430,13 +428,10 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     //Get the rquire fields value only.
     $params = $this->_params = $submittedValues;
 
-    $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($this->_params['payment_processor_id'],
-      $this->_mode
-    );
-
     //get the payment processor id as per mode.
+    //@todo unclear relevance of mode - seems like a lot of duplicated params here!
     $this->_params['payment_processor'] = $params['payment_processor_id'] =
-      $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
+    $this->_params['payment_processor_id'] = $submittedValues['payment_processor_id'] = $this->_paymentProcessor['id'];
 
     $now = date('YmdHis');
     $fields = array();
index b673f59dbb9245e3d0297e2f806190f801f1a56b..4f8141528127800f277e3f0dc461bff320d94eab 100644 (file)
@@ -308,8 +308,8 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
     }
     $processors = civicrm_api3('payment_processor', 'get', $retrievalParameters);
     foreach ($processors['values'] as $processor) {
+      $processors['values'][$processor['id']]['payment_processor_type'] = $processor['payment_processor_type'] = $processors['values'][$processor['id']]['api.payment_processor_type.getsingle']['name'];
       $processors['values'][$processor['id']]['object'] = CRM_Core_Payment::singleton(empty($processor['is_test']) ? 'live' : 'test', $processor);
-      $processors['values'][$processor['id']]['payment_processor_type'] = $processors['values'][$processor['id']]['api.payment_processor_type.getsingle']['name'];
     }
     /*
      CRM_Utils_Cache::singleton()->set($cacheKey, $processors);
index 3451e1b545d3ad5311297287e0d751342b1e925c..074a73c3c7826a30681813e3fc6ae4cf9531b9ba 100644 (file)
@@ -393,7 +393,6 @@ class CiviContributeProcessor {
           CRM_Core_DAO::$_nullObject, FALSE, 'live', 'REQUEST'
         );
 
-        require_once 'CRM/Financial/BAO/PaymentProcessor.php';
         $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($ppID, $mode);
 
         CRM_Core_Error::debug_log_message("Start Date=$start,  End Date=$end, ppID=$ppID, mode=$mode <p>", TRUE);