From: deb.monish Date: Fri, 10 Jun 2016 14:44:05 +0000 (+0530) Subject: additional fix for event and optimisation X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d38c288e6167182b989e07af236a14dc383279e6;p=civicrm-core.git additional fix for event and optimisation --- diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 422137a48c..07f60f40c5 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -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 diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index ac1728933e..cc8d156b04 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -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); diff --git a/CRM/Financial/Form/Payment.php b/CRM/Financial/Form/Payment.php index 8e13412d19..9cfa0ca6f7 100644 --- a/CRM/Financial/Form/Payment.php +++ b/CRM/Financial/Form/Payment.php @@ -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); diff --git a/templates/CRM/common/paymentBlock.tpl b/templates/CRM/common/paymentBlock.tpl index 73e05bba0e..c5adccbecb 100644 --- a/templates/CRM/common/paymentBlock.tpl +++ b/templates/CRM/common/paymentBlock.tpl @@ -87,7 +87,12 @@ {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} @@ -100,7 +105,7 @@ {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") {