CRM-18399: 'My billing address is the same as above' option goes away when selecting...
authordeb.monish <monish.deb@webaccessglobal.com>
Fri, 10 Jun 2016 11:29:50 +0000 (16:59 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Fri, 10 Jun 2016 11:29:50 +0000 (16:59 +0530)
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionBase.php
CRM/Core/Payment/ProcessorForm.php
CRM/Financial/Form/Payment.php

index 31eb6f5415826ee57bbe30eb05d019815df2103c..422137a48c4cf18d27d518191d8d6a0408b7bb4b 100644 (file)
@@ -291,14 +291,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
 
     $this->buildComponentForm($this->_id, $this);
 
-    if (!empty($this->_fields) && !empty($this->_values['custom_pre_id'])) {
-      $profileAddressFields = array();
-      foreach ($this->_fields as $key => $value) {
-        CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields, array('uf_group_id' => $this->_values['custom_pre_id']));
-      }
-      $this->set('profileAddressFields', $profileAddressFields);
-    }
-
     // Build payment processor form
     CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
 
index 4bd055855908d8d794d4ded5009c2aa57ceb9bb2..1e99b778f4a2b84f98fc57badb55c4a3bb92bc6b 100644 (file)
@@ -622,17 +622,9 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
         'financial_type' => 1,
       );
 
-      $fields = NULL;
-      if ($contactID && CRM_Core_BAO_UFGroup::filterUFGroups($id, $contactID)) {
-        $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE,
-          NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
-        );
-      }
-      else {
-        $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE,
-          NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
-        );
-      }
+      $fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE,
+        NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL
+      );
 
       if ($fields) {
         // unset any email-* fields since we already collect it, CRM-2888
index 5e140c2457a64970a795edec07e8b1f5625cc749..27d644e176d32e2cc8ef215d0fb68a205c43b954 100644 (file)
@@ -73,6 +73,19 @@ class CRM_Core_Payment_ProcessorForm {
       $form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(NULL, NULL, 'cancel');
     }
 
+    if (!empty($form->_values['custom_pre_id'])) {
+      $profileAddressFields = array();
+      $fields = CRM_Core_BAO_UFGroup::getFields($form->_values['custom_pre_id'], FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE,
+        NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL);
+
+      foreach ((array) $fields as $key => $value) {
+        CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields, array('uf_group_id' => $form->_values['custom_pre_id']));
+      }
+      if (count($profileAddressFields)) {
+        $form->set('profileAddressFields', $profileAddressFields);
+      }
+    }
+
     //checks after setting $form->_paymentProcessor
     // we do this outside of the above conditional to avoid
     // saving the country/state list in the session (which could be huge)
index 69d4225f099ca2503365c1415445c17f82075002..8e13412d19cc53ee7787ef5129c1bc0557076b69 100644 (file)
@@ -48,6 +48,13 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form {
    */
   public function preProcess() {
     parent::preProcess();
+
+    // reload and set values of contributionPage
+    $id = CRM_Utils_Request::retrieve('id', 'Integer');
+    if (!empty($id)) {
+      CRM_Contribute_BAO_ContributionPage::setValues($id, $this->_values);
+    }
+
     $this->_paymentProcessorID = CRM_Utils_Request::retrieve('processor_id', 'Integer', CRM_Core_DAO::$_nullObject,
       TRUE);
     $this->currency = CRM_Utils_Request::retrieve('currency', 'String', CRM_Core_DAO::$_nullObject,