CRM-16239 changed order of the function parameters
authorsunil <esunil.pawar@gmail.com>
Tue, 7 Apr 2015 07:00:18 +0000 (12:30 +0530)
committersunil <esunil.pawar@gmail.com>
Tue, 7 Apr 2015 07:00:18 +0000 (12:30 +0530)
js/Common.js
templates/CRM/Member/Form/Membership.tpl
templates/CRM/Member/Form/MembershipRenewal.tpl
templates/CRM/common/l10n.js.tpl

index 97ff46d0b4f70e8d1a356a2a18367d9cc4eec44d..4950046ee0bdb7aceefe511e5117f0c53822a5d8 100644 (file)
@@ -1333,18 +1333,18 @@ CRM.strings = CRM.strings || {};
   /**
    * Clientside currency formatting
    * @param number value
+   * @param [optional] boolean onlyNumber - if true, we return formated amount without currency sign
    * @param [optional] string format - currency representation of the number 1234.56
    * @return string
    */
   var currencyTemplate;
-  CRM.formatMoney = function(value, format, onlyNumber) {
+  CRM.formatMoney = function(value, onlyNumber, format) {
     var decimal, separator, sign, i, j, result;
     if (value === 'init' && format) {
       currencyTemplate = format;
       return;
     }
     format = format || currencyTemplate;
-    onlyNumber = onlyNumber || false;
     result = /1(.?)234(.?)56/.exec(format);
     if (result === null) {
       return 'Invalid format passed to CRM.formatMoney';
index 2e302a260a7a0e521640fdd295dcde751d62b7e7..db37b4786bcdaeb88e43e26832afd4d7fb7bad4d 100644 (file)
           else {
       var feeTotal = Number((taxRate/100) * (allMemberships[memType]['total_amount_numeric'] * term))+Number(allMemberships[memType]['total_amount_numeric'] * term );
           }
-          cj("#total_amount").val(CRM.formatMoney(feeTotal, '', true));
+          cj("#total_amount").val(CRM.formatMoney(feeTotal, true));
         }
         else {
     if (taxRate) {
             var feeTotal = parseFloat(Number((taxRate/100) * allMemberships[memType]['total_amount'])+Number(allMemberships[memType]['total_amount_numeric'])).toFixed(2);
-      cj("#total_amount").val(CRM.formatMoney(feeTotal, '', true));
+      cj("#total_amount").val(CRM.formatMoney(feeTotal, true));
           }
           else {
       var feeTotal = allMemberships[memType]['total_amount'];
index 43555d7f484dc6e03851986e61c9b638f6e805c3..ac3bf9eef9aae1e9da2405956efcb6f5ee4cb00f 100644 (file)
       var term = cj("#num_terms").val();
       if (term) {
         var renewTotal = allMemberships[memType]['total_amount_numeric'] * term;
-        cj("#total_amount").val(CRM.formatMoney(renewTotal, '', true));
+        cj("#total_amount").val(CRM.formatMoney(renewTotal, true));
       }
       else {
         cj("#total_amount").val(allMemberships[memType]['total_amount']);
index a43891a2c21c961826024e65e56918692b216338..c239bc79e562b1d5e98d15371df9029b1ba0ad53 100644 (file)
@@ -39,7 +39,7 @@
 
   // Initialize CRM.url and CRM.formatMoney
   CRM.url({ldelim}back: '{crmURL p="*path*" q="*query*" h=0 fb=1}', front: '{crmURL p="*path*" q="*query*" h=0 fe=1}'{rdelim});
-  CRM.formatMoney('init', {$moneyFormat});
+  CRM.formatMoney('init', false, {$moneyFormat});
 
   // Localize select2
   $.fn.select2.defaults.formatNoMatches = "{ts escape='js'}None found.{/ts}";