CRM_Core_PseudoConstant::country(),
'is_required' => TRUE,
);
+ //CRM-15509 working towards giving control over billing fields to payment processors. For now removing tpl hard-coding
+ $smarty = CRM_Core_Smarty::singleton();
+ $smarty->assign('billingDetailsFields', array(
+ 'billing_first_name',
+ 'billing_middle_name',
+ 'billing_last_name',
+ "billing_street_address-{$bltID}",
+ "billing_city-{$bltID}",
+ "billing_country_id-{$bltID}",
+ "billing_state_province_id-{$bltID}".
+ "billing_postal_code-{$bltID}",
+ ));
}
/**
$smarty = CRM_Core_Smarty::singleton();
$smarty->assign('paymentTypeName', 'credit_card');
$smarty->assign('paymentTypeLabel', ts('Credit Card Information'));
+ $smarty->assign('paymentFields', array(
+ 'credit_card_type',
+ 'credit_card_number',
+ 'cvv2',
+ 'credit_card_exp_date',
+ ));
}
/**
* @param CRM_Core_Form $form
+ * @param bool $useRequired
*/
static function addCommonFields(&$form, $useRequired) {
foreach ($form->_paymentFields as $name => $field) {
// replace these payment type names with an option group - moving name & label assumptions out of the tpl is a step towards that
$smarty->assign('paymentTypeName', 'direct_debit');
$smarty->assign('paymentTypeLabel', ts('Direct Debit Information'));
+ $smarty->assign('paymentFields', array(
+ 'account_holder',
+ 'bank_account_number',
+ 'bank_identification_number',
+ 'bank_name',
+ ));
}
/**
{* Callback snippet: Load payment processor *}
{elseif $snippet}
-{include file="CRM/Core/BillingBlock.tpl" context="front-end"}
+{include file="CRM/Core/BillingBlock.tpl"}
{if $is_monetary}
{* Put PayPal Express button after customPost block since it's the submit button in this case. *}
{if $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
cj('input[name="soft_credit_type_id"]').on('change', function() {
enableHonorType();
});
-
+
function enableHonorType( ) {
- var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
+ var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
if ( selectedValue.val() > 0) {
cj('#honorType').show();
}
});
function showRecurHelp( ) {
- var showHelp = cj('input[id="is_recur"]:checked');
+ var showHelp = cj('input[id="is_recur"]:checked');
if ( showHelp.val() > 0) {
cj('#recurHelp').show();
}
cj('#recurHelp').hide();
}
}
-
+
function pcpAnonymous( ) {
// clear nickname field if anonymous is true
if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
updatePriceSetHighlight();
function toggleBillingBlockIfFree(){
- var total_amount_tmp = $(this).data('raw-total');
+ var total_amount_tmp = $(this).data('raw-total');
// Hide billing questions if this is free
if (total_amount_tmp == 0){
cj("#billing-payment-block").hide();
- cj(".payment_options-group").hide();
- }
+ cj(".payment_options-group").hide();
+ }
else {
cj("#billing-payment-block").show();
- cj(".payment_options-group").show();
+ cj(".payment_options-group").show();
}
}
+--------------------------------------------------------------------+
*}
{crmRegion name="billing-block"}
- {* Add 'required' marker to billing fields in this template for front-end / online contribution and event registration forms only. *}
-{if $context EQ 'front-end'}
- {assign var=reqMark value=' <span class="crm-marker" title="This field is required.">*</span>'}
-{else}
- {assign var=reqMark value=''}
-{/if}
-{if $form.credit_card_number or $form.bank_account_number}
+{if $paymentFields}
<div id="payment_information">
<fieldset class="billing_mode-group {$paymentTypeName}_info-group">
<legend>
</div>
</div>
{/if}
-
- {if $paymentProcessor.billing_mode & 1}
- <div class="crm-section billing_mode-section {if $paymentProcessor.payment_type & 2}direct_debit_info-section{else}credit_card_info-section{/if}">
- {if $paymentProcessor.payment_type & 2}
- <div class="crm-section {$form.account_holder.name}-section">
- <div class="label">{$form.account_holder.label}</div>
- <div class="content">{$form.account_holder.html}</div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.bank_account_number.name}-section">
- <div class="label">{$form.bank_account_number.label}</div>
- <div class="content">{$form.bank_account_number.html}</div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.bank_identification_number.name}-section">
- <div class="label">{$form.bank_identification_number.label}</div>
- <div class="content">{$form.bank_identification_number.html}</div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.bank_name.name}-section">
- <div class="label">{$form.bank_name.label}</div>
- <div class="content">{$form.bank_name.html}</div>
- <div class="clear"></div>
- </div>
- {else}
- <div class="crm-section {$form.credit_card_type.name}-section">
- <div class="label">{$form.credit_card_type.label} {$reqMark}</div>
- <div class="content">
- {$form.credit_card_type.html}
- <div class="crm-credit_card_type-icons"></div>
- </div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.credit_card_number.name}-section">
- <div class="label">{$form.credit_card_number.label} {$reqMark}</div>
- <div class="content">{$form.credit_card_number.html|crmAddClass:creditcard}</div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.cvv2.name}-section">
- <div class="label">{$form.cvv2.label} {$reqMark}</div>
- <div class="content">
- {$form.cvv2.html}
- <span class="cvv2-icon"
- title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}"> </span>
+ <div class="crm-section billing_mode-section {$paymentTypeName}_info-section">
+ {foreach from=$paymentFields item=paymentField}
+ <div class="crm-section {$form.$paymentField.name}-section">
+ <div class="label">{$form.$paymentField.label}</div>
+ <div class="content">{$form.$paymentField.html}
+ {if $paymentField == 'cvv2'}{* @todo move to form assignment*}
+ <span class="cvv2-icon" title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}"> </span>
+ {/if}
+ {if $paymentField == 'credit_card_type'}
+ <div class="crm-credit_card_type-icons"></div>
+ {/if}
</div>
<div class="clear"></div>
</div>
- <div class="crm-section {$form.credit_card_exp_date.name}-section">
- <div class="label">{$form.credit_card_exp_date.label} {$reqMark}</div>
- <div class="content">{$form.credit_card_exp_date.html}</div>
- <div class="clear"></div>
- </div>
- {/if}
+ {/foreach}
</div>
- </fieldset>
- {else}
- </fieldset>
- {/if}
{/if}
- {if $profileAddressFields}
- <input type="checkbox" id="billingcheckbox" value="0">
- <label for="billingcheckbox">{ts}My billing address is the same as above{/ts}</label>
- {/if}
- <fieldset class="billing_name_address-group">
- <legend>{ts}Billing Name and Address{/ts}</legend>
- <div class="crm-section billing_name_address-section">
- <div class="crm-section {$form.billing_first_name.name}-section">
- <div class="label">{$form.billing_first_name.label} {$reqMark}</div>
- <div class="content">{$form.billing_first_name.html}</div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.billing_middle_name.name}-section">
- <div class="label">{$form.billing_middle_name.label}</div>
- <div class="content">{$form.billing_middle_name.html}</div>
- <div class="clear"></div>
- </div>
- <div class="crm-section {$form.billing_last_name.name}-section">
- <div class="label">{$form.billing_last_name.label} {$reqMark}</div>
- <div class="content">{$form.billing_last_name.html}</div>
- <div class="clear"></div>
- </div>
- {assign var=n value=billing_street_address-$bltID}
- <div class="crm-section {$form.$n.name}-section">
- <div class="label">{$form.$n.label} {$reqMark}</div>
- <div class="content">{$form.$n.html}</div>
- <div class="clear"></div>
- </div>
- {assign var=n value=billing_city-$bltID}
- <div class="crm-section {$form.$n.name}-section">
- <div class="label">{$form.$n.label} {$reqMark}</div>
- <div class="content">{$form.$n.html}</div>
- <div class="clear"></div>
- </div>
- {assign var=n value=billing_country_id-$bltID}
- <div class="crm-section {$form.$n.name}-section">
- <div class="label">{$form.$n.label} {$reqMark}</div>
- <div class="content">{$form.$n.html|crmAddClass:big}</div>
- <div class="clear"></div>
- </div>
- {assign var=n value=billing_state_province_id-$bltID}
- <div class="crm-section {$form.$n.name}-section">
- <div class="label">{$form.$n.label} {$reqMark}</div>
- <div class="content">{$form.$n.html|crmAddClass:big}</div>
- <div class="clear"></div>
- </div>
- {assign var=n value=billing_postal_code-$bltID}
- <div class="crm-section {$form.$n.name}-section">
- <div class="label">{$form.$n.label} {$reqMark}</div>
- <div class="content">{$form.$n.html}</div>
- <div class="clear"></div>
+ {if $billingDetailsFields}
+ {if $profileAddressFields}
+ <input type="checkbox" id="billingcheckbox" value="0">
+ <label for="billingcheckbox">{ts}My billing address is the same as above{/ts}</label>
+ {/if}
+ <fieldset class="billing_name_address-group">
+ <legend>{ts}Billing Name and Address{/ts}</legend>
+ <div class="crm-section billing_name_address-section">
+ {foreach from=$billingDetailsFields item=billingField}
+ <div class="crm-section {$form.$billingField.name}-section">
+ <div class="label">{$form.$billingField.label}</div>
+ {if $form.$billingField.type == 'text'}
+ <div class="content">{$form.$billingField.html}</div>
+ {else}
+ <div class="content">{$form.$billingField.html|crmAddClass:big}</div>
+ {/if}
+ <div class="clear"></div>
+ </div>
+ {/foreach}
</div>
- </div>
- </fieldset>
-
+ </fieldset>
+ {/if}
</div>
{if $profileAddressFields}
<script type="text/javascript">