| Openbravo Issue Tracking System - Openbravo ERP | 
| View Issue Details | 
| 
 | 
| ID | Project | Category | View Status | Date Submitted | Last Update | 
| 0020365 | Openbravo ERP | A. Platform | public | 2012-04-26 17:26 | 2012-06-27 05:29 | 
| 
 | 
| Reporter | egoitz |  | 
| Assigned To | migueldejuana |  | 
| Priority | high | Severity | minor | Reproducibility | always | 
| Status | closed | Resolution | fixed |  | 
| Platform |  | OS | 5 | OS Version |  | 
| Product Version | 3.0MP10.1 |  | 
| Target Version | 3.0MP13 | Fixed in Version | 3.0MP13 |  | 
| Merge Request Status |  | 
| Review Assigned To |  | 
| OBNetwork customer | OBPS | 
| Web browser |  | 
| Modules | Core | 
| Support ticket | 15239 | 
| Regression level |  | 
| Regression date |  | 
| Regression introduced in release |  | 
| Regression introduced by commit |  | 
| Triggers an Emergency Pack | No | 
| 
 | 
| Summary | 0020365: 'Length' word is not included on AD_ISJAVAWORD function to avoid to use it on column names | 
| Description | '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.
 
 
 | 
| Steps To Reproduce | -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"
 | 
| Proposed Solution | 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.
 | 
| Additional Information |  | 
| Tags | No tags attached. | 
| Relationships | | related to | defect | 0020827 |  | closed | alostale | Not possible to add new columns to ad_column table | 
 | 
| Attached Files |  issue20365.commit (8,040) 2012-05-29 15:04 https://issues.openbravo.com/file_download.php?file_id=5267&type=bug
 | 
| 
 | 
| Issue History | 
| Date Modified | Username | Field | Change | 
| 2012-04-26 17:26 | egoitz | New Issue |  | 
| 2012-04-26 17:26 | egoitz | Assigned To | => alostale | 
| 2012-04-26 17:26 | egoitz | Modules | => Core | 
| 2012-04-26 17:26 | egoitz | OBNetwork customer | => Yes | 
| 2012-04-26 17:26 | egoitz | Support ticket | => 15239 | 
| 2012-04-26 17:26 | egoitz | Resolution time | => 1341093600 | 
| 2012-04-27 07:48 | alostale | Assigned To | alostale => migueldejuana | 
| 2012-05-09 11:28 | migueldejuana | Note Added: 0048496 |  | 
| 2012-05-09 11:28 | migueldejuana | Status | new => feedback | 
| 2012-05-23 10:00 | egoitz | Status | feedback => new | 
| 2012-05-23 10:00 | egoitz | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=3497#r3497 | 
| 2012-05-23 12:07 | shuehner | Issue Monitored: shuehner |  | 
| 2012-05-23 14:56 | migueldejuana | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=3500#r3500 | 
| 2012-05-29 15:03 | migueldejuana | Note Added: 0049431 |  | 
| 2012-05-29 15:03 | migueldejuana | File Added: 20365issue.export |  | 
| 2012-05-29 15:04 | migueldejuana | File Added: issue20365.commit |  | 
| 2012-05-29 15:04 | migueldejuana | File Deleted: 20365issue.export |  | 
| 2012-06-15 16:42 | hgbot | Checkin |  | 
| 2012-06-15 16:42 | hgbot | Note Added: 0049864 |  | 
| 2012-06-15 16:42 | hgbot | Status | new => resolved | 
| 2012-06-15 16:42 | hgbot | Resolution | open => fixed | 
| 2012-06-15 16:42 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/2c50e12c22aaa63d3b8660262965ff6687540713 [^] | 
| 2012-06-15 16:42 | alostale | Note Added: 0049865 |  | 
| 2012-06-15 16:42 | alostale | Status | resolved => closed | 
| 2012-06-15 16:42 | alostale | Fixed in Version | => 3.0MP13 | 
| 2012-06-21 16:34 | alostale | Relationship added | related to 0020827 | 
| 2012-06-22 09:00 | hgbot | Checkin |  | 
| 2012-06-22 09:00 | hgbot | Note Added: 0050006 |  | 
| 2012-06-27 05:29 | hudsonbot | Checkin |  | 
| 2012-06-27 05:29 | hudsonbot | Note Added: 0050156 |  | 
	| Notes | 
	| 
 | 
	|  | 
		
			| 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?
 |  | 
	| 
 | 
	|  | 
		
			| 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
 ---
 
 |  | 
	| 
 | 
	|  | 
		
			| 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
 ---
 
 |  | 
	| 
 | 
	|  |  |