CRM-CRM-17539, CRM-16929 make payment_method optional for /bin/bash value
authoreileen <emcnaughton@wikimedia.org>
Thu, 12 Nov 2015 04:43:33 +0000 (20:43 -0800)
committereileen <emcnaughton@wikimedia.org>
Thu, 12 Nov 2015 04:43:33 +0000 (20:43 -0800)
CRM/Contribute/Form/Contribution/Main.php
CRM/Core/Payment/ProcessorForm.php

index 16f245cd4e337be6fcfbb1f2cb0699287893acaf..301c1cc963343f48b2722369b3e880c4f5acef05 100644 (file)
@@ -905,8 +905,8 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
       return $errors;
     }
 
-    if (CRM_Utils_Array::value('payment_method', $fields) == NULL) {
-      $errors['payment_method'] = ts('Payment Method is a required field.');
+    if (CRM_Utils_Array::value('payment_processor_id', $fields) == NULL) {
+      $errors['payment_processor_id'] = ts('Payment Method is a required field.');
     }
     else {
       CRM_Core_Payment_Form::validatePaymentInstrument(
index 86706dd81b36d1ba5fd9697cb14c398cab56aee7..dd493be0bc3209a91082466f75d6705e9e147754 100644 (file)
@@ -57,6 +57,10 @@ class CRM_Core_Payment_ProcessorForm {
       $form->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($form->_type, $form->_mode);
     }
 
+    if (empty($form->_paymentProcessor)) {
+      // This would happen when hitting the back-button on a multi-page form with a $0 selection in play.
+      return;
+    }
     $form->set('paymentProcessor', $form->_paymentProcessor);
     $form->_paymentObject = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor);