Openbravo Issue Tracking System - Openbravo ERP | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0048662 | Openbravo ERP | A. Platform | public | 2022-02-23 16:49 | 2022-02-23 16:49 |
Reporter | vmromanos | ||||
Assigned To | Triage Platform Base | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | ||||
Merge Request Status | |||||
Review Assigned To | |||||
OBNetwork customer | |||||
Web browser | |||||
Modules | Core | ||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0048662: FilterExpression class receives number with thousand separator | ||||
Description | A 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 Reproduce | Login 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 Solution | Several 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. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
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 |
There are no notes attached to this issue. |