CRM-19931 - Payment block is not hidden if fee level with amount zero is chosen
authoryashodha <yashodha.chaku@webaccessglobal.com>
Wed, 25 Jan 2017 10:45:30 +0000 (16:15 +0530)
committeryashodha <yashodha.chaku@webaccessglobal.com>
Wed, 25 Jan 2017 10:45:30 +0000 (16:15 +0530)
templates/CRM/Event/Form/Registration/Register.tpl

index 6261637e4073e5d044c754f0a6e7e6df9805c9dd..1e60ead5f4defd1afd85241cdfcbe07cf9520e3a 100644 (file)
       }
     }
 
+    cj('input[name^="price_"]').on('change', function () {
+      skipPaymentMethod();
+    });
+
     cj('input[name="payment_processor"]').change(function () {
       toggleConfirmButton();
     });
     // Called from display() in Calculate.tpl, depends on display() having been called.
     function skipPaymentMethod() {
       // If we're in quick-config price set, we do not have the pricevalue hidden element, so just return.
-      if (cj('#pricevalue').length == 0) {
+
+      var quickConfig = "{/literal}{$quickConfig}{literal}";
+      if (quickConfig) {
+        currentTotal = cj('input[name^=price_]:checked').data('amount');
+      }
+      else if (cj('#pricevalue').length == 0) {
         return;
       }
-      // CRM-15433 Remove currency symbol, decimal separator so we can check for zero numeric total regardless of localization.
-      currentTotal = cj('#pricevalue').text().replace(/[^\/\d]/g,'');
+      else {
+        // CRM-15433 Remove currency symbol, decimal separator so we can check for zero numeric total regardless of localization.
+        currentTotal = cj('#pricevalue').text().replace(/[^\/\d]/g,'');
+      }
       var isMultiple = '{/literal}{$event.is_multiple_registrations}{literal}';
 
       var flag = 1;