From: Coleman Watts Date: Mon, 13 Jan 2014 23:31:55 +0000 (-0800) Subject: CRM-14059 - Contribution form - Fix onbehalf profile ajax load X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ab234a8a3c69323dd87911abeaf4a44819e38a81;p=civicrm-core.git CRM-14059 - Contribution form - Fix onbehalf profile ajax load --- diff --git a/CRM/Contribute/Form/Contribution/Main.php b/CRM/Contribute/Form/Contribution/Main.php index 68918da67f..7eb123c9cc 100644 --- a/CRM/Contribute/Form/Contribution/Main.php +++ b/CRM/Contribute/Form/Contribution/Main.php @@ -69,9 +69,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu parent::preProcess(); self::preProcessPaymentOptions($this); - if ($this->_snippet) { - return; - } // Make the contributionPageID avilable to the template $this->assign('contributionPageID', $this->_id); @@ -114,6 +111,11 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } $this->assign('onBehalfRequired', $this->_onBehalfRequired); + if ($this->_snippet) { + $this->assign('isOnBehalfCallback', CRM_Utils_Array::value('onbehalf', $_GET, FALSE)); + return; + } + if (!empty($this->_pcpInfo['id']) && !empty($this->_pcpInfo['intro_text'])) { $this->assign('intro_text', $this->_pcpInfo['intro_text']); } @@ -346,7 +348,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu } // Build payment processor form - if ($this->_ppType) { + if ($this->_ppType && empty($_GET['onbehalf'])) { CRM_Core_Payment_ProcessorForm::buildQuickForm($this); // Return if we are in an ajax callback if ($this->_snippet) { @@ -358,6 +360,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if ($this->_onbehalf) { CRM_Contribute_Form_Contribution_OnBehalfOf::buildQuickForm($this); + // Return if we are in an ajax callback + if ($this->_snippet) { + return; + } } $this->applyFilter('__ALL__', 'trim'); diff --git a/templates/CRM/Contribute/Form/Contribution/Main.tpl b/templates/CRM/Contribute/Form/Contribution/Main.tpl index 84a01fea6d..92cfe826bd 100644 --- a/templates/CRM/Contribute/Form/Contribution/Main.tpl +++ b/templates/CRM/Contribute/Form/Contribution/Main.tpl @@ -23,9 +23,12 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} +{* Callback snippet: On-behalf profile *} +{if $snippet and !empty($isOnBehalfCallback)} + {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl" context="front-end"} {* Callback snippet: Load payment processor *} -{if $snippet} +{elseif $snippet} {include file="CRM/Core/BillingBlock.tpl" context="front-end"} {if $is_monetary} {* Put PayPal Express button after customPost block since it's the submit button in this case. *} @@ -182,7 +185,7 @@ {if $is_for_organization}
- {include file=CRM/Contribute/Form/Contribution/OnBehalfOf.tpl} + {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
{/if} diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index 8dbc5d9700..b6ec06bf92 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -129,8 +129,9 @@ {/foreach}
{$form.mode.html}
+ {/if} - +{if empty($snippet)} {literal} - +{/if}