Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027065Openbravo ERPA. Platformpublic2014-07-14 14:402014-08-08 18:53
dbaz 
dbaz 
highminoralways
closedfixed 
5
 
3.0PR14Q4 
alostale
Core
No
0027065: new Function('return isc.' ...)() could be simplified
There are so many times where we want the Smartclient property of a canvas item, but we don't have the canvas object but the string of its name.

In these cases things like this:

  new Function('return isc.' + this.editorType + '.getPrototype().showTime')()

or

  new Function('return isc.' + this.editorType + '.getInstanceProperty("showTime")')()

are performed to obtain a particular attribute value. This is done to avoid the "eval" function.


It is not intended to use the new function in all places where getProperty or getInstanceProperty be called, just in those places where the "new Function(...)()" is needed.
.
No tags attached.
Issue History
2014-07-14 14:40dbazNew Issue
2014-07-14 14:40dbazAssigned To => dbaz
2014-07-14 14:40dbazModules => Core
2014-07-14 14:40dbazTriggers an Emergency Pack => No
2014-07-14 14:41dbazReview Assigned To => alostale
2014-07-14 14:42dbazNote Added: 0068619
2014-07-14 14:53hgbotCheckin
2014-07-14 14:53hgbotNote Added: 0068620
2014-07-14 14:53hgbotStatusnew => resolved
2014-07-14 14:53hgbotResolutionopen => fixed
2014-07-14 14:53hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/a0de2cc4d7b50e4e5f4f737751358fd2f1e3e9d9 [^]
2014-07-21 15:03alostaleNote Added: 0068766
2014-07-21 15:03alostaleStatusresolved => closed
2014-07-21 15:03alostaleFixed in Version => 3.0PR14Q4
2014-08-08 18:53hudsonbotCheckin
2014-08-08 18:53hudsonbotNote Added: 0069156

Notes
(0068619)
dbaz   
2014-07-14 14:42   
OB.Utilities.getCanvasProp(this.editorType, 'showTime');

will be the new function. It also will check that the canvas exists before trying to obtain the attribute value.
(0068620)
hgbot   
2014-07-14 14:53   
Repository: erp/devel/pi
Changeset: a0de2cc4d7b50e4e5f4f737751358fd2f1e3e9d9
Author: David Baz Fayos <david.baz <at> openbravo.com>
Date: Mon Jul 14 14:53:07 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/a0de2cc4d7b50e4e5f4f737751358fd2f1e3e9d9 [^]

Fixed issue 27065: Added 'OB.Utilities.getCanvasProp' function
to avoid new Function('return isc....getPrototype()....')() solutions

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js
---
(0068766)
alostale   
2014-07-21 15:03   
code reviewed + tested
(0069156)
hudsonbot   
2014-08-08 18:53   
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/4450016dee64 [^]
Maturity status: Test