Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-18424 better amount label for repeat transactions #8157

Merged
merged 2 commits into from
May 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions templates/CRM/Contribute/Form/Contribution/Main.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -300,32 +300,6 @@
{/if}

{literal}
if ({/literal}"{$form.is_recur}"{literal}) {
if (document.getElementsByName("is_recur")[0].checked == true) {
window.onload = function() {
enablePeriod();
}
}
}

function enablePeriod ( ) {
var frqInt = {/literal}"{$form.frequency_interval}"{literal};
if ( document.getElementsByName("is_recur")[0].checked == true ) {
//get back to auto renew settings.
var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
if ( allowAutoRenew && cj("#auto_renew") ) {
showHideAutoRenew( null );
}
}
else {
//disabled auto renew settings.
var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
if ( allowAutoRenew && cj("#auto_renew") ) {
cj("#auto_renew").prop('checked', false );
cj('#allow_auto_renew').hide( );
}
}
}

cj('input[name="soft_credit_type_id"]').on('change', function() {
enableHonorType();
Expand All @@ -342,16 +316,22 @@
}

cj('input[id="is_recur"]').on('change', function() {
showRecurHelp();
toggleRecur();
});

function showRecurHelp( ) {
var showHelp = cj('input[id="is_recur"]:checked');
if ( showHelp.val() > 0) {
function toggleRecur( ) {
var isRecur = cj('input[id="is_recur"]:checked');
var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
if ( allowAutoRenew && cj("#auto_renew") ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@monishdeb I think moving this showHideAutoRenew call up here (out of the later if) solves the regression problem you found. showHideAutoRenew is clever enough to ... show AND hide

showHideAutoRenew( null );
}
if (isRecur.val() > 0) {
cj('#recurHelp').show();
cj('#amount_sum_label').text(ts('Regular amount'));
}
else {
cj('#recurHelp').hide();
cj('#amount_sum_label').text(ts('Total amount'));
}
}

Expand Down Expand Up @@ -381,7 +361,7 @@

CRM.$(function($) {
enableHonorType();
showRecurHelp();
toggleRecur();
skipPaymentMethod();
});

Expand Down
9 changes: 4 additions & 5 deletions templates/CRM/Price/Form/Calculate.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@

{assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay}
<div id="pricesetTotal" class="crm-section section-pricesetTotal">
{if !$hideTotal}
<div class="label" id="pricelabel">
<div class="label
{if $hideTotal}, hiddenElement{/if}" id="pricelabel">
<label>
{if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )}
{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}
{if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
<span id='amount_sum_label'>{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}</span>
{if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}
{/if}
</label>
</div>
{/if}
<div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue" ></div>
</div>

Expand Down