parent::preProcess();
self::preProcessPaymentOptions($this);
- if ($this->_snippet) {
- return;
- }
// Make the contributionPageID avilable to the template
$this->assign('contributionPageID', $this->_id);
}
$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']);
}
}
// 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) {
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');
| 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. *}
{if $is_for_organization}
<div id='onBehalfOfOrg' class="crm-section">
- {include file=CRM/Contribute/Form/Contribution/OnBehalfOf.tpl}
+ {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
</div>
{/if}
{/foreach}
</div>
<div>{$form.mode.html}</div>
+</fieldset>
{/if}
-
+{if empty($snippet)}
{literal}
<script type="text/javascript">
cj( "div#id-onbehalf-orgname-help").hide( );
function showOnBehalf(onBehalfRequired) {
if ( cj( "#is_for_organization" ).attr( 'checked' ) || onBehalfRequired ) {
- var urlPath = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&onbehalf=1'}";
- urlPath += "{$urlParams}";
+ var urlPath = {/literal}"{crmURL p=$urlPath h=0 q="snippet=4&onbehalf=1&id=$contributionPageID&qfKey=$qfKey"}";
{if $mode eq 'test'}
urlPath += '&action=preview';
{/if}
urlPath += '&reset={$reset}';
{/if}{literal}
cj("#onBehalfOfOrg").show();
- if (cj("#onBehalfOfOrg *").length < 1) {
- cj.ajax({
- url : urlPath,
- global : false,
- async : false,
- success : function ( content ) {
- cj( "#onBehalfOfOrg" ).html( content );
- }
- });
+ if (cj("fieldset", '#onBehalfOfOrg').length < 1) {
+ cj('#onBehalfOfOrg').load(urlPath);
}
}
else {
{/if}
</script>
-</fieldset>
+{/if}