Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0048662
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminoralways2022-02-23 16:492022-02-23 16:49
ReportervmromanosView Statuspublic 
Assigned ToTriage Platform Base 
PrioritynormalResolutionopenFixed in Version
StatusnewFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0048662: FilterExpression class receives number with thousand separator

DescriptionA class that implements the org.openbravo.client.application.FilterExpression java interface receives as parameter a "context", which is a json object with some properties.

In case of a property that represents a number, the property is sent as a String and it includes the thousand separator. Example:
"inpexpectedQty":"2,000"
(the number represents two thousand)

Usually you want to parse this number into a BigDecimal using the BigDecimal(String) constructor. The problem is that this thousand separator is not allowed for the BigDecimal constructor and it fails.


Note that in the case of callouts we have the similar need of parsing a number, but in that case there is an API to properly do it [CalloutInfo.getBigDecimalParameter()].

In the case of FilterExpression we don't have such an API.
Steps To ReproduceLogin in Backend to the AWO-QA client
Create a Purchase Order for
 - US West Coast
 - Be Soft Drinker, Inc.
 - US West Coast warehouse
Enter a line for 2000 units of Ale beer
Book the order.

Now press Receive button and Done.
Go to the Task tab just below Order Line, select the task and set Confirmed Quantity = 1.
Press Confirm button.
Notice that the Delta Response mandatory field is empty, because the DeltaResponseDefaultExpression (https://gitlab.com/openbravo/product/pmods/org.openbravo.warehouse.advancedwarehouseoperations/-/blob/master/src/org/openbravo/warehouse/advancedwarehouseoperations/filterexpression/DeltaResponseDefaultExpression.java#L67 [^]) has thrown an exception trying to parse the number.

java.lang.NumberFormatException: Character , is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
    at java.math.BigDecimal.<init>(BigDecimal.java:518) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:401) ~[?:?]
    at java.math.BigDecimal.<init>(BigDecimal.java:834) ~[?:?]
    at org.openbravo.warehouse.advancedwarehouseoperations.filterexpression.DeltaResponseDefaultExpression.isExpectedQtyEqualOrLowerThanConfirmedQty(DeltaResponseDefaultExpression.java:67) ~[classes/:?]
Proposed SolutionSeveral possibilities I see:
- To send numbers as numbers in the JSON (not as String). That would represent an API change.
- To keep on sending numbers as Strings, but making sure we don't have thousand separator, and that the decimal separator is a fixed parameter (dot)
- To have an API in java to easily parse a number in FilterExpression (and any other related class), like we have in callouts, which is able to remove the thousand separator and to set the decimal separator to a dot.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2022-02-23 16:49 vmromanos New Issue
2022-02-23 16:49 vmromanos Assigned To => Triage Platform Base
2022-02-23 16:49 vmromanos Modules => Core
2022-02-23 16:49 vmromanos Triggers an Emergency Pack => No


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker