From ffbdcdba27e425f25ce7d9bbee1c3ecde9ef3afa Mon Sep 17 00:00:00 2001 From: Nicolas Ganivet Date: Wed, 28 Sep 2016 12:13:09 -0400 Subject: [PATCH] CRM-17991: Fix Safari JS bug in Contribution popups (affects soft credits, pledges) --- .../CRM/Contribute/Form/Contribution.tpl | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index bbda7ed235..c889d54d42 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -467,11 +467,6 @@ } } - function status() { - cj("#cancel_date").val(''); - cj("#cancel_reason").val(''); - } - {/literal} @@ -498,25 +493,26 @@ {/literal}{if !$contributionMode}{literal} CRM.$(function($) { - showHideCancelInfo(cj('#contribution_status_id')); + showHideCancelInfo($('#contribution_status_id')); - cj('#contribution_status_id').change(function() { - showHideCancelInfo(cj('#contribution_status_id')); + $('#contribution_status_id').change(function() { + showHideCancelInfo($('#contribution_status_id')); } ); - }); - function showHideCancelInfo(obj) { - if (obj.find(":selected").text() == 'Refunded' || obj.find(":selected").text() == 'Cancelled') { - cj('#cancelInfo').show( ); - cj('#total_amount').attr('readonly', true); - } - else { - status(); - cj('#cancelInfo').hide( ); - cj("#total_amount").removeAttr('readonly'); - } - } + function showHideCancelInfo(obj) { + if (obj.find(":selected").text() == 'Refunded' || obj.find(":selected").text() == 'Cancelled') { + $('#cancelInfo').show( ); + $('#total_amount').attr('readonly', true); + } + else { + $("#cancel_date").val(''); + $("#cancel_reason").val(''); + $('#cancelInfo').hide( ); + $("#total_amount").removeAttr('readonly'); + } + } + }); {/literal}{/if}{literal} -- 2.25.1