CRM-17991: Fix Safari JS bug in COntribution popups (affects softcredits, pledges).
authorMathieu Lutfy <mathieu@bidon.ca>
Tue, 27 Sep 2016 15:21:27 +0000 (11:21 -0400)
committerMathieu Lutfy <mathieu@bidon.ca>
Tue, 27 Sep 2016 15:21:27 +0000 (11:21 -0400)
templates/CRM/Contribute/Form/Contribution.tpl

index 4d509a865d6b83546598a24d75525c79892a8a99..78462bdaeb98e2d39842aabf929a047557b16480 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>