Merge pull request #6638 from pradpnayak/CRM-16542-PaypalExp
authorDave Greenberg <dave@civicrm.org>
Fri, 11 Sep 2015 20:34:13 +0000 (13:34 -0700)
committerDave Greenberg <dave@civicrm.org>
Fri, 11 Sep 2015 20:34:13 +0000 (13:34 -0700)
--CRM-16542, fixed code for form rule for Paypal Express

CRM/Core/Payment/ProcessorForm.php

index f29b28581c85d5da7deb788464c93974939d96f4..9baed6cc8ffb273879d49976af0fcc2eb3de8d7a 100644 (file)
@@ -110,10 +110,13 @@ class CRM_Core_Payment_ProcessorForm {
     //@todo document why this addHidden is here
     //CRM-15743 - we should not set/create hidden element for pay later
     // because payment processor is not selected
-    if (!empty($form->_paymentProcessorID)) {
+    $processorId = $form->getVar('_paymentProcessorID');
+    $isBillingAddressRequiredForPayLater = $form->_isBillingAddressRequiredForPayLater;
+    if (!empty($processorId)) {
+      $isBillingAddressRequiredForPayLater = FALSE;
       $form->addElement('hidden', 'hidden_processor', 1);
     }
-    CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, empty($form->_isBillingAddressRequiredForPayLater), FALSE);
+    CRM_Core_Payment_Form::buildPaymentForm($form, $form->_paymentProcessor, empty($isBillingAddressRequiredForPayLater), FALSE);
   }
 
 }