Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0020365Openbravo ERPA. Platformpublic2012-04-26 17:262012-06-27 05:29
egoitz 
migueldejuana 
highminoralways
closedfixed 
5
3.0MP10.1 
3.0MP133.0MP13 
Core
No
0020365: 'Length' word is not included on AD_ISJAVAWORD function to avoid to use it on column names
'Length' word is not included on AD_ISJAVAWORD function to avoid to use it on column names.

A part of that if lenght is used as field name you get a javascrip error because it is a reserved word for javascript.

-Add a new column on a table with "Length" name (i.e.: c_invoice table)
-Define the column on application dictionary with name "Length" (i.e.: Invoice table)
-Create a new field for the previous column with name "Length" (i.e.: Sales Invoice window)
- Login, open Sales Invoice window and open Form view.
- You get a javascript error: "Uncaught RangeError: Invalid array length"
Add lenght workd on AD_ISJAVAWORD function

Create two new triggers , for ad_field and ad_element to avoid using the workds on the AD_ISJAVAWORD function also on elements or fields.

The trigger AD_COLUMN_TRG2.xml checks it on column but also should be analyzed on fields and elements.
No tags attached.
related to defect 0020827 closed alostale Not possible to add new columns to ad_column table 
? issue20365.commit (8,040) 2012-05-29 15:04
https://issues.openbravo.com/file_download.php?file_id=5267&type=bug
Issue History
2012-04-26 17:26egoitzNew Issue
2012-04-26 17:26egoitzAssigned To => alostale
2012-04-26 17:26egoitzModules => Core
2012-04-26 17:26egoitzResolution time => 1341093600
2012-04-27 07:48alostaleAssigned Toalostale => migueldejuana
2012-05-09 11:28migueldejuanaNote Added: 0048496
2012-05-09 11:28migueldejuanaStatusnew => feedback
2012-05-23 10:00egoitzStatusfeedback => new
2012-05-23 10:00egoitzSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3497#r3497
2012-05-23 12:07shuehnerIssue Monitored: shuehner
2012-05-23 14:56migueldejuanaSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=3500#r3500
2012-05-29 15:03migueldejuanaNote Added: 0049431
2012-05-29 15:03migueldejuanaFile Added: 20365issue.export
2012-05-29 15:04migueldejuanaFile Added: issue20365.commit
2012-05-29 15:04migueldejuanaFile Deleted: 20365issue.export
2012-06-15 16:42hgbotCheckin
2012-06-15 16:42hgbotNote Added: 0049864
2012-06-15 16:42hgbotStatusnew => resolved
2012-06-15 16:42hgbotResolutionopen => fixed
2012-06-15 16:42hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2c50e12c22aaa63d3b8660262965ff6687540713 [^]
2012-06-15 16:42alostaleNote Added: 0049865
2012-06-15 16:42alostaleStatusresolved => closed
2012-06-15 16:42alostaleFixed in Version => 3.0MP13
2012-06-21 16:34alostaleRelationship addedrelated to 0020827
2012-06-22 09:00hgbotCheckin
2012-06-22 09:00hgbotNote Added: 0050006
2012-06-27 05:29hudsonbotCheckin
2012-06-27 05:29hudsonbotNote Added: 0050156

Notes
(0048496)
migueldejuana   
2012-05-09 11:28   
I cannot reproduce.

Following Steps to Reproduce, I don't get errors. What error should be showed?
Using length as name for a field, I don't get javascript error. Steps to Reproduce?
Elements and Columns have 'DBColumnName' and 'Name', both should be analyzed?
(0049431)
migueldejuana   
2012-05-29 15:03   
The javascript error is in ob-view-form.js(line 527):

localResult[fields[i].columnName.toLowerCase()] = fields[i];

We are trying to do this:

localResult["length"] = fields[i];

It causes an error because length is a property of Array Object and we shouldn't use this reserved words as Array Object key.

I have attached a diff with the proposed solution.
(0049864)
hgbot   
2012-06-15 16:42   
Repository: erp/devel/pi
Changeset: 2c50e12c22aaa63d3b8660262965ff6687540713
Author: Miguel de Juana <miguel.dejuana <at> openbravo.com>
Date: Thu May 24 13:41:52 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/2c50e12c22aaa63d3b8660262965ff6687540713 [^]

fixed bug 20365: Don't allow legth as column/field name as it causes js errors

---
M src-db/database/model/functions/AD_ISJAVAWORD.xml
M src-db/database/model/triggers/AD_COLUMN_TRG2.xml
M src-db/database/model/triggers/AD_ELEMENT_TRG.xml
M src-db/database/model/triggers/AD_FIELD_TRG.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
---
(0049865)
alostale   
2012-06-15 16:42   
Code reviewed and tested in pi@2c50e12c22aa
(0050006)
hgbot   
2012-06-22 09:00   
Repository: erp/devel/pi
Changeset: 4152ff6e040d482c19c62666ac07433caa412079
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jun 22 08:58:59 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4152ff6e040d482c19c62666ac07433caa412079 [^]

fixed bug 20827: Not possible to add new columns to ad_column table
related to bug 20365

  Partially backed out fix 0020365: field and element are not checked,
  just ad_column.columnname is checked with a different function to allow names
  that can be included for ad_colum.name.

---
M src-db/database/model/functions/AD_ISJAVAWORD.xml
M src-db/database/model/triggers/AD_COLUMN_TRG2.xml
M src-db/database/model/triggers/AD_ELEMENT_TRG.xml
M src-db/database/model/triggers/AD_FIELD_TRG.xml
M src-db/database/sourcedata/AD_MESSAGE.xml
A src-db/database/model/functions/AD_ISJAVASCRIPTWORD.xml
---
(0050156)
hudsonbot   
2012-06-27 05:29   
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/cf3a7135839f [^]

Maturity status: Test