From 82e5b06283972911572c07a481a4672d5c40339d Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Sat, 17 Jun 2017 20:47:37 +0530 Subject: [PATCH] CRM-20495 : 'Contribution amounts section' checkbox setting on contribution pages always shows as checked --- .../Form/ContributionPage/Amount.tpl | 76 +++++++++---------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl b/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl index 6d0b338fec..5a3e24e997 100644 --- a/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl +++ b/templates/CRM/Contribute/Form/ContributionPage/Amount.tpl @@ -338,48 +338,44 @@ } } - function showHideAmountBlock( element, elementName ) - { - // show / hide when amount section is active check/uncheck. - - var priceSetID = {/literal}'{$priceSetID}'{literal}; - - switch ( elementName ) { + function showHideAmountBlock(element, elementName) { + // show / hide when amount section is active check/uncheck. + var priceSetID = {/literal}'{$priceSetID}'{literal}; + switch (elementName) { case 'price_set_id': - if ( element ) { - cj('#amountFields').hide(); - } else { - cj('#amountFields').show(); - } - cj("#amount_block_is_active").prop('checked', true ); - break; - - case 'is_pledge_active' : - case 'is_allow_other_amount' : - if ( element.checked ) { - if ( priceSetID ) cj( "#price_set_id" ).val( '' ); - cj('#amountFields').show(); - } - cj("#amount_block_is_active").prop('checked', true ); - break; - - case 'amount_block_is_active' : - if ( element.checked ) { - if ( priceSetID ) { - cj('#amountFields').hide(); - cj( "#price_set_id" ).val( priceSetID ); - } else { - cj('#amountFields').show(); - cj( "#price_set_id" ).val( '' ); + if (element) { + cj('#amountFields').hide(); } - cj('#priceSet, #recurringFields').show(); - } else { - cj( "#price_set_id" ).val( '' ); - cj('#amountFields, #priceSet, #recurringFields').hide(); - } - break; - } - } + break; + + case 'is_pledge_active': + case 'is_allow_other_amount': + if (element.checked) { + if (priceSetID) cj( "#price_set_id" ).val(''); + cj('#amountFields').show(); + } + cj("#amount_block_is_active").prop('checked', true ); + break; + + case 'amount_block_is_active': + if (element.checked) { + if (priceSetID) { + cj('#amountFields').hide(); + cj( "#price_set_id" ).val(priceSetID); + } + else { + cj('#amountFields').show(); + cj( "#price_set_id" ).val(''); + } + cj('#priceSet, #recurringFields').show(); + } + else { + cj( "#price_set_id" ).val(''); + cj('#amountFields, #priceSet, #recurringFields').hide(); + } + break; + } + } function showRecurring( paymentProcessorIds ) { var display = true; -- 2.25.1