Merge remote branch 'canonical/master' into merge-forward
[civicrm-core.git] / CRM / Contribute / Form / ContributionBase.php
index d60a8405bc202ca634ef1da78e8c55ae289845c3..4d061840def1e452f83f7440ff760d2a26600dd2 100644 (file)
@@ -211,6 +211,8 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    * @var boolean
    */
   public $_useForMember;
+
+  public $_isBillingAddressRequiredForPayLater;
   /**
    * Function to set variables up before form is built
    *
@@ -526,6 +528,12 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
     if (CRM_Utils_Request::retrieve('cancel', 'Boolean', CRM_Core_DAO::$_nullObject)) {
       self::cancelRecurring();
     }
+
+    // check if billing block is required for pay later
+    if (CRM_Utils_Array::value('is_pay_later', $this->_values)) {
+      $this->_isBillingAddressRequiredForPayLater = CRM_Utils_Array::value('is_billing_required', $this->_values);
+      $this->assign('isBillingAddressRequiredForPayLater', $this->_isBillingAddressRequiredForPayLater);
+    }
   }
 
   /**