CRM-21595 re-fix CRM-21445
authoreileen <emcnaughton@wikimedia.org>
Sat, 23 Dec 2017 19:29:00 +0000 (08:29 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 4 Jan 2018 02:17:39 +0000 (15:17 +1300)
CRM/Contribute/Form/ContributionBase.php

index cdd2818f835efa03381b4296b0e720a5af82ce17..3b90eae83850f34ddefadb1b91e3259981077927 100644 (file)
@@ -294,9 +294,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
     $this->_fields = $this->get('fields');
     $this->_bltID = $this->get('bltID');
     $this->_paymentProcessor = $this->get('paymentProcessor');
-    if (!$this->_paymentProcessor) {
-      $this->_paymentProcessor = array('object' => Civi\Payment\System::singleton()->getById(0));
-    }
+
     $this->_priceSetId = $this->get('priceSetId');
     $this->_priceSet = $this->get('priceSet');
 
@@ -581,9 +579,10 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
 
     // The concept of contributeMode is deprecated.
     // The payment processor object can provide info about the fields it shows.
-    if ($isMonetary) {
+    if ($isMonetary && is_a($this->_paymentProcessor['object'], 'CRM_Core_Payment')) {
       /** @var  $paymentProcessorObject \CRM_Core_Payment */
       $paymentProcessorObject = $this->_paymentProcessor['object'];
+
       $paymentFields = $paymentProcessorObject->getPaymentFormFields();
       foreach ($paymentFields as $index => $paymentField) {
         if (!isset($this->_params[$paymentField])) {