Fixed issue 30014: There are problems with big numbers in scientific notation
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Tue, 26 May 2015 17:30:26 +0200
changeset 26810 03456ea1fc63
parent 26809 f65d30c40217
child 26811 f8b937eb67f2
child 26813 9cdfae4d18ae
Fixed issue 30014: There are problems with big numbers in scientific notation

The problem was in OB.Utilities.Number.OBMaskedToOBPlain.
When the function was executed with a big negative number in scientific notation or a positive number with the "+" sign at the beginning, the
obtained decimal value was not correct.
This was caused because the length of the variable "number" (which was the number in scientific notation), was used for creating the final number instead of the
length of the variable "plainNumber", (which was the number in decimal notation).
This generated a problem because, when the spected result was a number longer than the number in scientific notation, it was not correctly obtained.
For example:

-1.0564E7 returned -10564000. This is correct, but:

-1.0564E8 returned -10564000. And this is not correct.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-number.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-number.js	Tue May 26 22:37:10 2015 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-number.js	Tue May 26 17:30:26 2015 +0200
@@ -73,10 +73,10 @@
   var numberSign = '';
   if (plainNumber.substring(0, 1) === '+') {
     numberSign = '';
-    plainNumber = plainNumber.substring(1, number.length);
+    plainNumber = plainNumber.substring(1, plainNumber.length);
   } else if (plainNumber.substring(0, 1) === '-') {
     numberSign = '-';
-    plainNumber = plainNumber.substring(1, number.length);
+    plainNumber = plainNumber.substring(1, plainNumber.length);
   }
 
   // Remove ending decimal '0'