CIVICRM-1718: Default terms = 1 in (edit) Membership form javascript
authorFrancis Whittle <francis@agileware.com.au>
Fri, 23 Apr 2021 03:17:18 +0000 (13:17 +1000)
committerFrancis Whittle <francis@agileware.com.au>
Fri, 23 Apr 2021 03:17:18 +0000 (13:17 +1000)
templates/CRM/Member/Form/Membership.tpl

index 6f61bba51aede8b07132f5aa7eba1f09a51348bc..2da528bd352321f1c038a048344749da93f72d87 100644 (file)
 
         // skip this for test and live modes because financial type is set automatically
         cj("#financial_type_id").val(membershipType['financial_type_id']);
-        var term = cj('#num_terms').val();
+        // Get the number of terms from the form, default to 1 if no num_terms element.
+        var term = cj('#num_terms').val() || 1;
         var taxTerm = {/literal}{$taxTerm|@json_encode}{literal};
         var currency = {/literal}{$currency_symbol|@json_encode}{literal};
         var taxExclusiveAmount = membershipType['total_amount_numeric'] * term;