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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0037390
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 00. Application dictionaryminoralways2017-11-27 12:332018-01-03 12:39
ReportergorkaionView Statuspublic 
Assigned Toalostale 
PriorityhighResolutionfixedFixed in Version3.0PR18Q1
StatusclosedFix in branchFixed in SCM revision6a9db69516b2
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0037390: < and > operators fail when comparing negative values in Display Logic

Description"<" and ">" are not properly managed by DynamicExpressionParser and produces a wrong javascript code when comparing with negative values.

When creating a Display Logic like:
@grandTotalAmount@ < - 5

It is translated to:
OB.Utilities.getValue(currentValues,'grandTotalAmount') < !== 5

This is caused because the "<" is not considered as a comparator and the "-" sign is considered instead. In this case it replaces the "-" with "!==" which results in a wrong js code.
Steps To ReproduceOn Sales Invoice window.

Create some invoices with negative and positive total amounts.

On the Application Dictionary modify the Display Logic of the "APRM Process Invoice" field to "@GrandTotal@ > - 5". So it only shows the "Complete" button if the total amount of the invoice is higher than "-5".

Try to open the Sales Invoice tab and it fails. If you check the browser's console you see a javascript error with the wrong displayIf function.
Proposed SolutionAdd the "<", ">", "<=" and ">=" to the array of "COMPARATIONS" in DynamicExpressionParser. So the negative number is considered as the right part of the expression and the "-" sign is not replaced by "!==".
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0100754)
hgbot (developer)
2017-11-28 09:57

Repository: erp/devel/pi
Changeset: 6a9db69516b2560f153d3390235b88d447af4d7e
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Nov 28 09:48:01 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/6a9db69516b2560f153d3390235b88d447af4d7e [^]

fixed bug 37390: can't compare gt or lt with negative values in display logic

  When comparing negative values with gt (>), lt (>), ge (>=) or le (>=) the
  generated JavaScript expression was incorrect.

  Those operators were not properly parsed because they were not declared in
  DynamicExpressionParser.

---
M modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/DynamicExpressionParserTest.java
M modules/org.openbravo.client.application/src/org/openbravo/client/application/DynamicExpressionParser.java
---
(0100800)
caristu (developer)
2017-11-28 19:34

Code reviewed + tested OK.
(0101465)
hudsonbot (developer)
2018-01-03 12:39

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/c81e0d3cbab5 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-11-27 12:33 gorkaion New Issue
2017-11-27 12:33 gorkaion Assigned To => platform
2017-11-27 12:33 gorkaion Modules => Core
2017-11-27 12:33 gorkaion Triggers an Emergency Pack => No
2017-11-28 09:35 alostale Status new => scheduled
2017-11-28 09:35 alostale Assigned To platform => alostale
2017-11-28 09:57 hgbot Checkin
2017-11-28 09:57 hgbot Note Added: 0100754
2017-11-28 09:57 hgbot Status scheduled => resolved
2017-11-28 09:57 hgbot Resolution open => fixed
2017-11-28 09:57 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/6a9db69516b2560f153d3390235b88d447af4d7e [^]
2017-11-28 09:57 alostale Review Assigned To => caristu
2017-11-28 19:34 caristu Note Added: 0100800
2017-11-28 19:34 caristu Status resolved => closed
2017-11-28 19:34 caristu Fixed in Version => 3.0PR18Q1
2018-01-03 12:39 hudsonbot Checkin
2018-01-03 12:39 hudsonbot Note Added: 0101465


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker