From 4a3ed8390725cd28e29f6ae227704f2c48e96745 Mon Sep 17 00:00:00 2001 From: Mathieu Lutfy Date: Tue, 27 Sep 2016 11:21:27 -0400 Subject: [PATCH] CRM-17991: Fix Safari JS bug in COntribution popups (affects softcredits, pledges). --- .../CRM/Contribute/Form/Contribution.tpl | 42 ++++++++----------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 4d509a865d..78462bdaeb 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -470,12 +470,6 @@ } } } - - function status() { - cj("#cancel_date").val(''); - cj("#cancel_reason").val(''); - } - {/literal} @@ -502,26 +496,26 @@ {/literal}{if !$contributionMode}{literal} CRM.$(function($) { - showHideCancelInfo(cj('#contribution_status_id')); + showHideCancelInfo($('#contribution_status_id')); + + $('#contribution_status_id').change(function() { + showHideCancelInfo($('#contribution_status_id')); + }); - cj('#contribution_status_id').change(function() { - showHideCancelInfo(cj('#contribution_status_id')); + function showHideCancelInfo(obj) { + var cancelInfo_show_ids = [{/literal}{$cancelInfo_show_ids}{literal}]; + if (cancelInfo_show_ids.indexOf(obj.val()) > -1) { + $('#cancelInfo').show( ); + $('#total_amount').attr('readonly', true); + } + else { + $("#cancel_date").val(''); + $("#cancel_reason").val(''); + $('#cancelInfo').hide( ); + $("#total_amount").removeAttr('readonly'); + } } - ); - }); - - function showHideCancelInfo(obj) { - var cancelInfo_show_ids = [{/literal}{$cancelInfo_show_ids}{literal}]; - if (cancelInfo_show_ids.indexOf(obj.val()) > -1) { - cj('#cancelInfo').show( ); - cj('#total_amount').attr('readonly', true); - } - else { - status(); - cj('#cancelInfo').hide( ); - cj("#total_amount").removeAttr('readonly'); - } - } + }); {/literal}{/if}{literal} -- 2.25.1