Fixed maxprec formatting.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 23 Aug 2010 09:22:15 +0000 (09:22 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 23 Aug 2010 09:22:15 +0000 (09:22 +0000)
includes/current_user.inc
js/utils.js

index 3f9505671b8b8bbca515e015fcd3136d41edfce5..7763ae672e76bb473313d939da0150e2e7fa211e 100644 (file)
@@ -251,6 +251,7 @@ function qty_format($number, $stock_id=null, &$dec) {
        $dec = get_qty_dec($stock_id);
     return number_format2($number, $dec);
 }
+
 // and get_qty_dec
 function get_qty_dec($stock_id=null)
 {
@@ -267,7 +268,7 @@ function get_qty_dec($stock_id=null)
 //     Maximum precision format. Strips trailing unsignificant digits.
 //
 function maxprec_format($number) {
-    return number_format2($number, null);
+    return number_format2($number, 'max');
 }
 
 function exrate_format($number) {
index 1f1aa521c54a362d31b98326e7971a55022ced13..9b1b1ac479202cbb08e91cf391aa09298c97a2c9 100644 (file)
@@ -105,7 +105,7 @@ JsHttpRequest._request = function(trigger, form, tout, retry) {
                        // seek element by id if there is no elemnt with given name
                          objElement = document.getElementsByName(id)[0] || document.getElementById(id);
                  if(cmd=='as') {
-                                 eval("objElement.setAttribute('"+property+"',"+data+");");
+                                 eval("objElement.setAttribute('"+property+"','"+data+"');");
                          } else if(cmd=='up') {
 //                             if(!objElement) alert('No element "'+id+'"');
                                if(objElement) {
@@ -229,7 +229,8 @@ function price_format(post, num, dec, label, color) {
                num = num.substring(0,num.length-(4*i+3))+user.ts+
                        num.substring(num.length-(4*i+3));
         num = ((sign)?'':'-') + num;
-        if(dec!=0) num = num + user.ds + cents;
+       if(dec!=0 && (!max || cents!=0))
+               num = num + user.ds + cents;
        if(label)
            el.innerHTML = num;
        else