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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0029253
TypeCategorySeverityReproducibilityDate SubmittedLast Update
backport[Openbravo ERP] A. Platformminoralways2015-03-12 09:562015-04-01 08:31
ReportercaristuView Statuspublic 
Assigned ToAugustoMauch 
PriorityimmediateResolutionfixedFixed in Version3.0PR15Q1.2
StatusclosedFix in branchFixed in SCM revisionb2247094d251
ProjectionnoneETAnoneTarget Version3.0PR15Q1.2
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionpiSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression levelProduction - Confirmed Stable
Regression date2014-05-20
Regression introduced in release3.0PR14Q3
Regression introduced by commithttps://code.openbravo.com/erp/devel/pi/rev/d9ce373c75dad51598fb943d75e4d8e56f1d56eb [^]
Triggers an Emergency PackNo
Summary

0029253: Can't filter in numeric fields using the value 0

DescriptionIs not possible to filter numeric fields using the value 0, the following error appears in the javascript console:

  "Uncaught TypeError: Cannot read property 'operator' of undefined"
Steps To Reproduce1) Go to the Sales Order window
2) Try to filter by Delivery Status or Invoice Status fields , using the value 0
3) Notice that the filtering is not done and the error in description appears
TagsApproved
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
blocks defect 0029248 closedAugustoMauch Can't filter in numeric fields using the value 0 

-  Notes
(0075494)
hgbot (developer)
2015-03-12 16:47

Repository: erp/backports/3.0PR15Q1.2
Changeset: b2247094d2518e750d8c0fef33c702be4da71c1e
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Mar 12 12:00:30 2015 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR15Q1.2/rev/b2247094d2518e750d8c0fef33c702be4da71c1e [^]

Fixes issue 29253: 0 can be used to filter numeric columns

In this changeset [1] this code was added to the OBNumberItem.parseValueExpressions function:

     ret = this.Super('parseValueExpressions', [value, fieldName, operator]);
+
+ // if operator is not supported remove it
+ if (!this.validOperators.contains(ret.operator)) {
+ ret.operator = '';
+ ret.value = '';
+ this.setValue('');
+ }
     if (ret && ret.start) {
       ret.start = this.convertToTypedValue(ret.start);
     }

The problem is that if the provided value is 0, this.Super('parseValueExpressions', [value, fieldName, operator]) will return undefined. This happens because of a bug in smartclient's implementation of the
 parseValueExpressions function. This code is placed at the beginning of that function:

        if (!value) value = this.getValue();
        if (!value) return;
        if (!isc.isA.String(value)) value += "";

If the provided value is 0, the value will be taken from this.getValue(). The returned value will again be evaluated to false, so the function will not return any value. Right after that, there is a comman
d to convert the provided value to String.

To fix this, in the call to this.Super('parseValueExpressions'), the string representation of the number will be passed instead of its numerical value. This way smartclient will accept the value and will n
ot return undefined. Smartclient was already converting the passed values to String, so there is no risk there.

The value passed to the OBNumberItem.parseValueExpressions is not modified to prevent unexpected consequences. A copy of it is converted to string and passed to the this.Super('parseValueExpressions') func
tion.

[1] https://code.openbravo.com/erp/devel/pi/rev/d9ce373c75dad51598fb943d75e4d8e56f1d56eb [^]

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
---
(0075536)
alostale (manager)
2015-03-13 11:47

code reviewed

tested in Sales Order delivery status (computed column) and total gross amount (regular column) with values:
-0
-100
->1000
-<1000
-^3 (as reported in 0026305, in this case the filter is removed as it is not supported textual filters in numeric columns)
(0076210)
hgbot (developer)
2015-04-01 08:07

Repository: erp/backports/3.0PR15Q2
Changeset: b2247094d2518e750d8c0fef33c702be4da71c1e
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Mar 12 12:00:30 2015 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR15Q2/rev/b2247094d2518e750d8c0fef33c702be4da71c1e [^]

Fixes issue 29253: 0 can be used to filter numeric columns

In this changeset [1] this code was added to the OBNumberItem.parseValueExpressions function:

     ret = this.Super('parseValueExpressions', [value, fieldName, operator]);
+
+ // if operator is not supported remove it
+ if (!this.validOperators.contains(ret.operator)) {
+ ret.operator = '';
+ ret.value = '';
+ this.setValue('');
+ }
     if (ret && ret.start) {
       ret.start = this.convertToTypedValue(ret.start);
     }

The problem is that if the provided value is 0, this.Super('parseValueExpressions', [value, fieldName, operator]) will return undefined. This happens because of a bug in smartclient's implementation of the
 parseValueExpressions function. This code is placed at the beginning of that function:

        if (!value) value = this.getValue();
        if (!value) return;
        if (!isc.isA.String(value)) value += "";

If the provided value is 0, the value will be taken from this.getValue(). The returned value will again be evaluated to false, so the function will not return any value. Right after that, there is a comman
d to convert the provided value to String.

To fix this, in the call to this.Super('parseValueExpressions'), the string representation of the number will be passed instead of its numerical value. This way smartclient will accept the value and will n
ot return undefined. Smartclient was already converting the passed values to String, so there is no risk there.

The value passed to the OBNumberItem.parseValueExpressions is not modified to prevent unexpected consequences. A copy of it is converted to string and passed to the this.Super('parseValueExpressions') func
tion.

[1] https://code.openbravo.com/erp/devel/pi/rev/d9ce373c75dad51598fb943d75e4d8e56f1d56eb [^]

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
---
(0076266)
priyam (administrator)
2015-04-01 08:31

closed again, as the status changed due the merge tag of 3.0PR15Q1.2 to backports/3.0PR15Q2

- Issue History
Date Modified Username Field Change
2015-03-12 11:33 AugustoMauch Type defect => backport
2015-03-12 11:33 AugustoMauch Target Version => 3.0PR15Q1.2
2015-03-12 15:56 AugustoMauch Issue Monitored: alostale
2015-03-12 15:56 AugustoMauch Review Assigned To => alostale
2015-03-12 16:47 hgbot Checkin
2015-03-12 16:47 hgbot Note Added: 0075494
2015-03-12 16:47 hgbot Status scheduled => resolved
2015-03-12 16:47 hgbot Resolution open => fixed
2015-03-12 16:47 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR15Q1.2/rev/b2247094d2518e750d8c0fef33c702be4da71c1e [^]
2015-03-13 11:47 alostale Note Added: 0075536
2015-03-13 11:47 alostale Status resolved => closed
2015-03-13 11:47 alostale Fixed in Version => 3.0PR15Q1.2
2015-03-13 20:08 dmitry_mezentsev Tag Attached: Approved
2015-04-01 08:07 hgbot Checkin
2015-04-01 08:07 hgbot Note Added: 0076210
2015-04-01 08:07 hgbot Status closed => resolved
2015-04-01 08:07 hgbot Fixed in SCM revision http://code.openbravo.com/erp/backports/3.0PR15Q1.2/rev/b2247094d2518e750d8c0fef33c702be4da71c1e [^] => http://code.openbravo.com/erp/backports/3.0PR15Q2/rev/b2247094d2518e750d8c0fef33c702be4da71c1e [^]
2015-04-01 08:31 priyam Status resolved => closed
2015-04-01 08:31 priyam Note Added: 0076266


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker