Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0019712 | Openbravo ERP | A. Platform | public | 2012-02-09 16:05 | 2012-03-02 15:37 |
|
Reporter | VictorVillar | |
Assigned To | AugustoMauch | |
Priority | high | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | |
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 | 0019712: It should not generate a property name with a key words |
Description | If 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 Reproduce | the 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 } ]," |
Proposed Solution | |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | |
|
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 | |
Notes |
|
|
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
|
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
---
|
|
|
|
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. |
|
|
|
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. |
|
|
|
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 |
|
|
|
|