additional fix for event and optimisation
authordeb.monish <monish.deb@webaccessglobal.com>
Fri, 10 Jun 2016 14:44:05 +0000 (20:14 +0530)
committerdeb.monish <monish.deb@webaccessglobal.com>
Sun, 12 Jun 2016 18:42:39 +0000 (00:12 +0530)
CRM/Contribute/Form/Contribution/Main.php
CRM/Event/Form/Registration/Register.php
CRM/Financial/Form/Payment.php
templates/CRM/common/paymentBlock.tpl

index 422137a48c4cf18d27d518191d8d6a0408b7bb4b..07f60f40c53ce08d7313687772a66f3e53357a13 100644 (file)
@@ -289,6 +289,9 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $this->buildCustom($this->_values['custom_pre_id'], 'customPre');
     $this->buildCustom($this->_values['custom_post_id'], 'customPost');
 
+    // CRM-18399: used by template to pass pre profile id as a url arg
+    $this->assign('custom_pre_id', $this->_values['custom_pre_id']);
+
     $this->buildComponentForm($this->_id, $this);
 
     // Build payment processor form
index ac1728933e99dd6d94346df1027e0bef263d582a..cc8d156b04f599af66535fe6479f53f62922491c 100644 (file)
@@ -260,15 +260,8 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
     $this->buildCustom($this->_values['custom_pre_id'], 'customPre');
     $this->buildCustom($this->_values['custom_post_id'], 'customPost');
 
-    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);
-    }
+    // CRM-18399: used by template to pass pre profile id as a url arg
+    $this->assign('custom_pre_id', $this->_values['custom_pre_id']);
 
     CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
 
index 8e13412d19cc53ee7787ef5129c1bc0557076b69..9cfa0ca6f7cbdcdc6fb63fcf216eb8a7f8300e40 100644 (file)
@@ -49,11 +49,7 @@ 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->_values['custom_pre_id'] = CRM_Utils_Request::retrieve('pre_profile_id', 'Integer', $this);
 
     $this->_paymentProcessorID = CRM_Utils_Request::retrieve('processor_id', 'Integer', CRM_Core_DAO::$_nullObject,
       TRUE);
index 73e05bba0e63666d3266921fcf6b64deb73fafbd..c5adccbecbc461335526853e29db3b2a9616b45f 100644 (file)
       {if $contributionPageID}
         {capture assign='contributionPageID'}id={$contributionPageID}&{/capture}
       {else}
-        {capture assign='contributionPageID'}{/capture}
+        {capture assign='pageID'}{/capture}
+      {/if}
+      {if $custom_pre_id}
+        {capture assign='preProfileID'}pre_profile_id={$custom_pre_id}&{/capture}
+      {else}
+        {capture assign='preProfileID'}{/capture}
       {/if}
       {if $urlPathVar}
         {capture assign='urlPathVar'}{$urlPathVar}&{/capture}
         {capture assign='profilePathVar'}{/capture}
       {/if}
 
-      var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="currency=`$currency`&`$urlPathVar``$profilePathVar``$contributionPageID`processor_id="}" + type;
+      var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="currency=`$currency`&`$urlPathVar``$profilePathVar``$contributionPageID``$preProfileID`processor_id="}" + type;
       {literal}
       if (typeof(CRM.vars) != "undefined") {
         if (typeof(CRM.vars.coreForm) != "undefined") {