Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0028561Openbravo ERPA. Platformpublic2015-01-12 11:062015-11-23 21:17
AugustoMauch 
caristu 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q1 
alostale
Core
No
0028561: OB.Utilities.Number.ScientificToDecimal does not work properly with numbers with leading zeros
Given a number, the returned value of the OB.Utilities.Number.ScientificToDecimal varies if the number has leading zeros.

For instance:

OB.Utilities.Number.ScientificToDecimal('3.4e-2', '.') => "0.034" (OK)
OB.Utilities.Number.ScientificToDecimal('3.4e-02', '.') => "0.034" (OK)
OB.Utilities.Number.ScientificToDecimal('03.4e-2', '.') => "0.0034" (Wrong, a different number is returned)

OB.Utilities.Number.ScientificToDecimal('3.4e2', '.') => "340" (OK)
OB.Utilities.Number.ScientificToDecimal('3.4e02', '.') => "340" (OK)
OB.Utilities.Number.ScientificToDecimal('03.4e2', '.') => "0340" (A leading zero is added, it is not as wrong as with a negative exponent, but should also be fixed)



- Login in Openbravo
- Open the developers console.
- Enter this expressions and check that if the input number has leading zeroes the result varies.

OB.Utilities.Number.ScientificToDecimal('3.4e-2', '.');
OB.Utilities.Number.ScientificToDecimal('03.4e-2', '.');
OB.Utilities.Number.ScientificToDecimal('3.4e2', '.');
OB.Utilities.Number.ScientificToDecimal('03.4e2', '.');
No tags attached.
related to defect 00285523.0PR15Q2 closed alostale Purchase Invoice amount gets truncated upon saving, when the amount is big 
related to defect 00261323.0PR14Q3 closed guillermogil wrong visualization value of quantity fields with very small numbers 
Issue History
2015-01-12 11:06AugustoMauchNew Issue
2015-01-12 11:06AugustoMauchAssigned To => AugustoMauch
2015-01-12 11:06AugustoMauchModules => Core
2015-01-12 11:06AugustoMauchTriggers an Emergency Pack => No
2015-01-12 11:07AugustoMauchRelationship addedrelated to 0028552
2015-01-12 11:07AugustoMauchRelationship addedrelated to 0026132
2015-03-11 10:08alostalePrioritynormal => high
2015-03-11 10:08alostaleStatusnew => acknowledged
2015-03-17 14:37alostaleAssigned ToAugustoMauch => platform
2015-11-11 11:37alostalePriorityhigh => normal
2015-11-16 10:54caristuAssigned Toplatform => caristu
2015-11-16 10:54caristuStatusacknowledged => scheduled
2015-11-17 09:04caristuReview Assigned To => alostale
2015-11-17 09:04caristuIssue Monitored: alostale
2015-11-17 09:05hgbotCheckin
2015-11-17 09:05hgbotNote Added: 0081912
2015-11-17 09:05hgbotStatusscheduled => resolved
2015-11-17 09:05hgbotResolutionopen => fixed
2015-11-17 09:05hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/c6c9ab6f8caed480e671a6724dd6145ab8149c8c [^]
2015-11-23 08:56alostaleNote Added: 0082056
2015-11-23 08:56alostaleStatusresolved => closed
2015-11-23 08:56alostaleFixed in Version => 3.0PR16Q1
2015-11-23 21:17hudsonbotCheckin
2015-11-23 21:17hudsonbotNote Added: 0082246

Notes
(0081912)
hgbot   
2015-11-17 09:05   
Repository: erp/devel/pi
Changeset: c6c9ab6f8caed480e671a6724dd6145ab8149c8c
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Nov 17 09:04:02 2015 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/c6c9ab6f8caed480e671a6724dd6145ab8149c8c [^]

fixes issue 28561: OB.Utilities.Number.ScientificToDecimal and leading zeros

OB.Utilities.Number.ScientificToDecimal was not working properly if the number passed as parameter had leading zeros. To fix the problem we use a regular expression to remove them: we look for at least one zero at the beginning of the string representation of the number. If found, it is deleted by replacing it with ''.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-utilities-number-test.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-number.js
---
(0082056)
alostale   
2015-11-23 08:56   
code reviewed

tested

verified new test is executed as part of ci
(0082246)
hudsonbot   
2015-11-23 21:17   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7b56bebaaa88 [^]
Maturity status: Test