X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=templates%2FCRM%2FContribute%2FForm%2FContribution.tpl;h=b18562fccc106c8f33084ace436a6d38c7899be7;hb=161a2fe7bd9fb7d4cd9662544ed0bf2797bc3063;hp=7c5597dac574956f2111d2311d2797a13d7848cd;hpb=da7a33feb6f28d09a8b2de93cb702b43ed484851;p=civicrm-core.git
diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl
index 7c5597dac5..721a156e00 100644
--- a/templates/CRM/Contribute/Form/Contribution.tpl
+++ b/templates/CRM/Contribute/Form/Contribution.tpl
@@ -1,6 +1,6 @@
{*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
@@ -33,12 +33,6 @@
{include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
{else}
- {if $contributionMode}
-
{if $contributionMode == 'test' }
@@ -67,16 +61,18 @@
{ts}WARNING: Deleting this contribution will result in the loss of the associated financial transactions (if any).{/ts} {ts}Do you want to continue?{/ts}
{else}
-
- {include file="CRM/common/formButtons.tpl"}
{if $newCredit AND $action EQ 1 AND $contributionMode EQ null}
+
{/if}
+
+ {include file="CRM/common/formButtons.tpl"}
{if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if}
@@ -251,8 +247,7 @@
{$form.pcp_made_through_id.label} |
{$form.pcp_made_through_id.html}
- {ts}Search for the Personal Campaign Page by the fund-raiser's last name or
- email address.{/ts}
+ {ts}Search for the Personal Campaign Page by the fund-raiser's last name or email address.{/ts}
@@ -264,8 +259,7 @@
|
{$form.pcp_roll_nickname.label} |
{$form.pcp_roll_nickname.html|crmAddClass:big}
- {ts}Name or nickname contributor wants to be displayed in the Honor
- Roll. Enter "Anonymous" for anonymous contributions.{/ts}
+ {ts}Name or nickname contributor wants to be displayed in the Honor Roll. Enter "Anonymous" for anonymous contributions.{/ts}
|
@@ -307,12 +301,12 @@
{if $showCheckNumber || !$isOnline}
{$form.check_number.label} |
- {$form.check_number.html|crmReplace:class:six} |
+ {$form.check_number.html} |
{/if}
{$form.trxn_id.label} |
- {$form.trxn_id.html|crmReplace:class:twelve} {help id="id-trans_id"} |
+ {$form.trxn_id.html} {help id="id-trans_id"} |
{if $email and $outBound_option != 2}
@@ -399,38 +393,26 @@
{if $context eq 'standalone' and $outBound_option != 2 }
{literal}
CRM.$(function($) {
- cj("#contact_1").blur( function( ) {
- checkEmail( );
- });
+
+ var $form = $("form.{/literal}{$form.formClass}{literal}");
+ $("#contact_id", $form).change(checkEmail);
checkEmail( );
+
+ function checkEmail( ) {
+ var data = $("#contact_id", $form).select2('data');
+ if (data && data.extra && data.extra.email && data.extra.email.length) {
+ $("#email-receipt", $form).show();
+ $("#email-address", $form).html(data.extra.email);
+ }
+ else {
+ $("#email-receipt", $form).hide();
+ }
+ }
+
showHideByValue( 'is_email_receipt', '', 'receiptDate', 'table-row', 'radio', true);
showHideByValue( 'is_email_receipt', '', 'fromEmail', 'table-row', 'radio', false );
});
- function checkEmail( ) {
- var contactID = cj("input[name='contact_select_id[1]']").val();
- if (contactID) {
- var postUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' h=0}{literal}";
- cj.post( postUrl, {contact_id: contactID},
- function (response) {
- if (response) {
- cj("#email-receipt").show( );
- cj("#email-address").html(response);
- }
- else {
- cj("#email-receipt").hide( );
- }
- }
- );
- }
- else {
- cj("#email-receipt").hide( );
- }
- }
-
- function profileCreateCallback( blockNo ) {
- checkEmail( );
- }
{/literal}
{/if}
@@ -503,19 +485,20 @@
showHideCancelInfo(cj('#contribution_status_id'));
cj('#contribution_status_id').change(function() {
- showHideCancelInfo(this);
+ showHideCancelInfo(cj('#contribution_status_id'));
}
);
});
function showHideCancelInfo(obj) {
- contributionStatus = cj(obj).val();
- if (contributionStatus == 3 || contributionStatus == 7) {
+ if (obj.find(":selected").text() == 'Refunded' || obj.find(":selected").text() == 'Cancelled') {
cj('#cancelInfo').show( );
+ cj('#total_amount').attr('readonly', true);
}
else {
- status();
+ status();
cj('#cancelInfo').hide( );
+ cj("#total_amount").removeAttr('readonly');
}
}
@@ -621,5 +604,81 @@ cj('#fee_amount').change( function() {
cj('#net_amount').val(netAmount);
}
});
+
+cj("#financial_type_id").on("change",function(){
+ cj('#total_amount').trigger("change");
+})
+
+cj("#currency").on("change",function(){
+ cj('#total_amount').trigger("change");
+})
+
+{/literal}{if $taxRates && $invoicing}{literal}
+CRM.$(function($) {
+ $('#total_amount').on("change",function(event) {
+ if (event.handled !== true) {
+ var freezeFinancialType = '{/literal}{$freezeFinancialType}{literal}';
+ if (!freezeFinancialType) {
+ var financialType = $('#financial_type_id').val();
+ var taxRates = '{/literal}{$taxRates}{literal}';
+ taxRates = JSON.parse(taxRates);
+ var currencies = '{/literal}{$currencies}{literal}';
+ currencies = JSON.parse(currencies);
+ var currencySelect = $('#currency').val();
+ var currencySymbol = currencies[currencySelect];
+ var re= /\((.*?)\)/g;
+ for(m = re.exec(currencySymbol); m; m = re.exec(currencySymbol)){
+ currencySymbol = m[1];
+ }
+ var taxRate = taxRates[financialType];
+ if (!taxRate) {
+ taxRate = 0;
+ cj("#totalTaxAmount").hide( );
+ } else {
+ cj("#totalTaxAmount").show( );
+ }
+ var totalAmount = $('#total_amount').val();
+ var thousandMarker = '{/literal}{$config->monetaryThousandSeparator}{literal}';
+ var seperator = '{/literal}{$config->monetaryDecimalPoint}{literal}';
+ // replace all thousandMarker and change the seperator to a dot
+ totalAmount = totalAmount.replace(thousandMarker,'').replace(seperator,'.');
+
+ var totalTaxAmount = '{/literal}{$totalTaxAmount}{literal}';
+ var taxAmount = (taxRate/100)*totalAmount;
+ taxAmount = isNaN (taxAmount) ? 0:taxAmount;
+ var totalTaxAmount = taxAmount + Number(totalAmount);
+ totalTaxAmount = formatMoney( totalTaxAmount, 2, seperator, thousandMarker );
+
+ $("#totalTaxAmount" ).html('Amount with tax : ' + currencySymbol + ' '+ totalTaxAmount);
+ }
+ event.handled = true;
+ }
+ return false;
+ });
+
+ $('#total_amount').trigger("change");
+});
+{/literal}{/if}{literal}
+
+CRM.$(function($) {
+ $('#price_set_id').click(function() {
+ if( $('#price_set_id').val() ) {
+ $('#totalAmountBlock').hide();
+ }
+ else {
+ $('#totalAmountBlock').show();
+ }
+ });
+});
+
+function formatMoney (amount, c, d, t){
+ var n = amount,
+ c = isNaN(c = Math.abs(c)) ? 2 : c,
+ d = d == undefined ? "," : d,
+ t = t == undefined ? "." : t, s = n < 0 ? "-" : "",
+ i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
+ j = (j = i.length) > 3 ? j % 3 : 0;
+return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
+};
{/literal}