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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0019712
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminoralways2012-02-09 16:052012-03-02 15:37
ReporterVictorVillarView Statuspublic 
Assigned ToAugustoMauch 
PriorityhighResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision26012ec9699f
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

0019712: It should not generate a property name with a key words

DescriptionIf the user creates a column, for instance name: Default, the system creates a property with this name, but is the same as a reserved word for Javascript.
An error messages appear in log file, because one fields use a display logic with this property.
This example has been discovered due to the Human Capital Management module.
Steps To Reproducethe Human capital management module has a column called: Default, and the DB name: Isdefault, in the table HCMC_Contact.
Then the 'Make default' field has a display logic defined: @Isdefault@='N', so it is using this property, and the property uses the same reserved name in javascript.

we check the log file, and we can see this error:

" 92295e8 2012-02-09 11:49:57,953 [http-8080-11] ERROR org.openbravo.client.kernel.ComponentGenerator - Error parsing component View
>>>>>>> Issues found in javascript <<<<<<<<<
Human Capital Management Common.View:261:408: Expected an identifier and instead saw 'default' (a reserved word). >> offending code: {id: '3AE00E40575F11DEA0C3E7AD063433B2', title: 'Make Default', obManualURL: '/org.openbravo.hcm.commonEmployeeManagerView/Contact3ADEB662575F11DEAF7CB722376EC9B9_Edition.html', command: 'BUTTONMakedefaultB9CF97C70EB84448B34A8316C997E96A', property: 'makeDefaultContact', processId: 'B9CF97C70EB84448B34A8316C997E96A', modal: false, displayIf: function(form, currentValues, context) { return (currentValues.default === false); }, autosave: true } ],"
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0044972)
iperdomo (reporter)
2012-02-09 16:51

Perhaps we need to implement the expression generation using a getValue() function, instead of context.property.

getValue(object, property) {
  return object[property];
}

getValue(context, 'default') instead of context.default
(0045147)
hgbot (developer)
2012-02-15 13:31

Repository: erp/devel/pi
Changeset: 26012ec9699fae395f9d12f8126973a5f90c505f
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Feb 15 13:29:57 2012 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/26012ec9699fae395f9d12f8126973a5f90c505f [^]

Fixes issue 19712: Square bracket notation used for displaylogic

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/DynamicExpressionParser.java
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
---
(0045150)
AugustoMauch (manager)
2012-02-15 13:39

Now, when creating the javascript code for the display logics, the square brackets notation will be used.

Before the fix, the displaylogic @IsCustomer@ === 'Y' was translated to currentValues.customer === true. Now, it is going to be translated to OB.Utilities.getValue(currentValues,'customer') === true.

This prevents an error when using a reserved javascript word as a property name.
(0045151)
AugustoMauch (manager)
2012-02-15 13:41

Test plan:
- Check that displaylogics keep working.

I think the fix is not risky. Dot and square bracket notations are equivalent, so if a.b works, a['b'] is going to work.
(0045277)
iperdomo (reporter)
2012-02-20 13:20

Tested on pi @ rev e5b1fd6ab7c6

- Using System Administrator role
- Added a display logic to the Mapping tab of AD Implementation window
  @IsDefault@ = 'Y'
- Check that the display logic works
- Check that JSLint doesn't complain about language keywords
(0045856)
hudsonbot (developer)
2012-03-02 15:37

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/544d64e0c159 [^]

Maturity status: Test

- Issue History
Date Modified Username Field Change
2012-02-09 16:05 VictorVillar New Issue
2012-02-09 16:05 VictorVillar Assigned To => iperdomo
2012-02-09 16:05 VictorVillar Modules => Core
2012-02-09 16:06 VictorVillar Issue Monitored: networkb
2012-02-09 16:42 iperdomo Assigned To iperdomo => AugustoMauch
2012-02-09 16:51 iperdomo Note Added: 0044972
2012-02-15 13:31 hgbot Checkin
2012-02-15 13:31 hgbot Note Added: 0045147
2012-02-15 13:31 hgbot Status new => resolved
2012-02-15 13:31 hgbot Resolution open => fixed
2012-02-15 13:31 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/26012ec9699fae395f9d12f8126973a5f90c505f [^]
2012-02-15 13:39 AugustoMauch Note Added: 0045150
2012-02-15 13:41 AugustoMauch Note Added: 0045151
2012-02-20 13:20 iperdomo Note Added: 0045277
2012-02-20 13:20 iperdomo Status resolved => closed
2012-03-02 15:37 hudsonbot Checkin
2012-03-02 15:37 hudsonbot Note Added: 0045856


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker