details: https://code.openbravo.com/erp/devel/pi/rev/381047f42270
changeset: 22345:381047f42270
user: Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date: Wed Mar 05 11:28:14 2014 +0530
summary: Fixes Issue 0025517: Wrong calculations on numeric field depending
on the formula
Formatting of the number is done after evaluation of the math expression.
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
| 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 94e3b048685e -r 381047f42270
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
Tue Mar 04 20:54:42 2014 +0530
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
Wed Mar 05 11:28:14 2014 +0530
@@ -433,7 +433,12 @@
// Make sure the number is rounded using the number of decimal digits
specified in the number typeInstance
if (isc.isA.String(this.getValue())) {
- value = OB.Utilities.Number.OBPlainToOBMasked(this.getValue(),
this.typeInstance.maskNumeric, this.typeInstance.decSeparator,
this.typeInstance.groupSeparator);
+ //if the string is a math expression do not perform rounding yet.
+ if (this.getValue().indexOf('=') === -1) {
+ value = OB.Utilities.Number.OBPlainToOBMasked(this.getValue(),
this.typeInstance.maskNumeric, this.typeInstance.decSeparator,
this.typeInstance.groupSeparator);
+ } else {
+ value = this.getValue();
+ }
this.setValue(OB.Utilities.Number.OBMaskedToJS(value,
this.typeInstance.decSeparator, this.typeInstance.groupSeparator));
if (this.form.setTextualValue) {
this.form.setTextualValue(this.name, value, this.typeInstance);
@@ -461,7 +466,8 @@
// first check if the number is valid
if (!isc.isA.String(value)) {
- // format the value displayed
+ // format the value to be displayed.
+ value = OB.Utilities.Number.OBPlainToOBMasked(this.getValue(),
this.typeInstance.maskNumeric, this.typeInstance.decSeparator,
this.typeInstance.groupSeparator);
this.setElementValue(this.mapValueToDisplay(value));
}
}
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works.
Faster operations. Version large binaries. Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits