Merge remote branch 'canonical/master' into merge-forward
[civicrm-core.git] / CRM / Contribute / Form / ContributionBase.php
index ef6fcae79aaa02a4d1d46db2e22629ee3f76fca8..4d061840def1e452f83f7440ff760d2a26600dd2 100644 (file)
  */
 
 /**
- * This class generates form components for processing a ontribution
+ * This class generates form components for processing a contribution
  *
  */
 class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
 
   /**
-   * the id of the contribution page that we are proceessing
+   * the id of the contribution page that we are processsing
    *
    * @var int
    * @public
@@ -88,6 +88,11 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    */
   public $_membershipBlock = NULL;
 
+  /**
+   * Does this form support a separate membership payment
+   * @var bool
+   */
+  protected $_separateMembershipPayment;
   /**
    * the default values for the form
    *
@@ -110,7 +115,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    * @var array
    * @public
    */
-  public $_fields;
+  public $_fields = array();
 
   /**
    * The billing location id for this contribiution page
@@ -206,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
    *
@@ -521,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);
+    }
   }
 
   /**