Merge pull request #9124 from mlutfy/master-crm17991
authorcolemanw <coleman@civicrm.org>
Wed, 28 Sep 2016 13:50:53 +0000 (09:50 -0400)
committerGitHub <noreply@github.com>
Wed, 28 Sep 2016 13:50:53 +0000 (09:50 -0400)
CRM-17991: Fix Safari JS bug in COntribution popups (affects softcredits, pledges).

templates/CRM/Contribute/Form/Contribution.tpl

index 788cd265919a830d341843ebbedfd414464f1a4f..1dacf49824e5798f9556fdff22ebb4583b1fea0c 100644 (file)
       }
     }
   }
-
-  function status() {
-    cj("#cancel_date").val('');
-    cj("#cancel_reason").val('');
-  }
-
   </script>
   {/literal}
 
 
     {/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}
     </script>