Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0027670Openbravo ERPA. Platformpublic2014-09-24 12:522014-12-30 23:27
caristu 
alostale 
highminoralways
closedfixed 
5
pi 
3.0PR15Q13.0PR15Q1 
dbaz
Core
No
0027670: Time fields do not have the correct style in read only mode
Time fields do not have the correct style in read only mode (see attached). Both Absolute and Standard time fields are having this issue.
1) Create a new field of type Time/Absolute Time in any tab.
2) Put the UI Pattern of the tab where you have placed this new field as Read Only
3) Recompile the system
4) Access to the tab, notice that the read only style of the Absolute Time field is not the correct one.
No tags attached.
related to design defect 0025914 new AugustoMauch Grid cannot filter by fields with "Time" reference 
related to defect 0025916 closed dbaz "Time" and "Absolute Time" filter input has wrong height 
related to defect 0029561 closed dbaz Time Fields can't be set as read only 
png ATReadOnlyStyle.png (3,687) 2014-09-24 12:52
https://issues.openbravo.com/file_download.php?file_id=7275&type=bug
png

png WithData.png (4,358) 2014-09-25 19:17
https://issues.openbravo.com/file_download.php?file_id=7278&type=bug
png

? issue-27670.export (1,478) 2014-12-10 11:38
https://issues.openbravo.com/file_download.php?file_id=7590&type=bug
Issue History
2014-09-24 12:52caristuNew Issue
2014-09-24 12:52caristuAssigned To => AugustoMauch
2014-09-24 12:52caristuFile Added: ATReadOnlyStyle.png
2014-09-24 12:52caristuModules => Core
2014-09-24 12:52caristuResolution time => 1418079600
2014-09-24 12:52caristuTriggers an Emergency Pack => No
2014-09-24 12:52caristuIssue Monitored: networkb
2014-09-24 12:55caristuSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6627#r6627
2014-09-25 08:13shankarbAssigned ToAugustoMauch => shankarb
2014-09-25 11:53shankarbNote Added: 0070366
2014-09-25 19:17caristuNote Added: 0070399
2014-09-25 19:17caristuFile Added: WithData.png
2014-09-25 19:18caristuNote Edited: 0070399bug_revision_view_page.php?bugnote_id=0070399#r6640
2014-09-26 12:10shankarbSummaryAbsolute Time fields do not have the correct style in read only mode => Time fields do not have the correct style in read only mode
2014-09-26 12:10shankarbDescription Updatedbug_revision_view_page.php?rev_id=6650#r6650
2014-09-26 12:10shankarbSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6651#r6651
2014-09-29 08:31alostaleTarget Version3.0PR14Q4 => 3.0PR15Q1
2014-09-30 10:58shankarbAssigned Toshankarb => AugustoMauch
2014-11-21 10:51alostaleAssigned ToAugustoMauch => inigosanchez
2014-11-25 19:25hgbotCheckin
2014-11-25 19:25hgbotNote Added: 0072005
2014-11-25 19:25hgbotStatusnew => resolved
2014-11-25 19:25hgbotResolutionopen => fixed
2014-11-25 19:25hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/02f377fd13c624219b12b51e05d6f82d4a9a7d53 [^]
2014-11-25 19:26inigosanchezStatusresolved => new
2014-11-25 19:26inigosanchezResolutionfixed => open
2014-11-25 19:26inigosanchezIssue Monitored: alostale
2014-11-25 19:27inigosanchezReview Assigned To => alostale
2014-11-25 19:27inigosanchezStatusnew => scheduled
2014-11-25 19:27inigosanchezResolutionopen => fixed
2014-11-25 19:27inigosanchezStatusscheduled => resolved
2014-11-28 12:59alostaleNote Added: 0072129
2014-11-28 14:05hgbotCheckin
2014-11-28 14:05hgbotNote Added: 0072135
2014-12-01 12:09alostaleNote Added: 0072184
2014-12-01 12:09alostaleStatusresolved => new
2014-12-01 12:09alostaleResolutionfixed => open
2014-12-10 11:38inigosanchezFile Added: issue-27670.export
2014-12-10 11:40inigosanchezNote Added: 0072382
2014-12-10 13:24alostaleNote Added: 0072395
2014-12-10 13:25alostaleNote Edited: 0072395bug_revision_view_page.php?bugnote_id=0072395#r7234
2014-12-12 12:51alostaleRelationship addedrelated to 0025916
2014-12-12 14:39alostaleRelationship addedrelated to 0025914
2014-12-12 14:47alostaleAssigned Toinigosanchez => alostale
2014-12-12 14:48alostaleReview Assigned Toalostale => dbaz
2014-12-12 14:48alostaleIssue Monitored: dbaz
2014-12-12 14:56hgbotCheckin
2014-12-12 14:56hgbotNote Added: 0072455
2014-12-12 14:56hgbotStatusnew => resolved
2014-12-12 14:56hgbotResolutionopen => fixed
2014-12-12 14:56hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/02f377fd13c624219b12b51e05d6f82d4a9a7d53 [^] => http://code.openbravo.com/erp/devel/pi/rev/1339ca00c158f8c91108a2f63a0b031efdc85d0a [^]
2014-12-12 15:01alostaleNote Added: 0072457
2014-12-16 13:49dbazNote Added: 0072547
2014-12-16 13:49dbazStatusresolved => new
2014-12-16 13:49dbazResolutionfixed => open
2014-12-16 16:41alostaleNote Added: 0072566
2014-12-16 17:24hgbotCheckin
2014-12-16 17:24hgbotNote Added: 0072569
2014-12-16 17:24hgbotStatusnew => resolved
2014-12-16 17:24hgbotResolutionopen => fixed
2014-12-16 17:24hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/1339ca00c158f8c91108a2f63a0b031efdc85d0a [^] => http://code.openbravo.com/erp/devel/pi/rev/87a7c215c8263c417f957a4f1672b90a69e475c2 [^]
2014-12-17 13:25dbazNote Added: 0072636
2014-12-17 13:25dbazStatusresolved => closed
2014-12-17 13:25dbazFixed in Version => 3.0PR15Q1
2014-12-30 23:26hudsonbotCheckin
2014-12-30 23:26hudsonbotNote Added: 0073141
2014-12-30 23:26hudsonbotCheckin
2014-12-30 23:26hudsonbotNote Added: 0073154
2014-12-30 23:27hudsonbotCheckin
2014-12-30 23:27hudsonbotNote Added: 0073212
2014-12-30 23:27hudsonbotCheckin
2014-12-30 23:27hudsonbotNote Added: 0073224
2015-04-10 13:16caristuRelationship addedrelated to 0029561

Notes
(0070366)
shankarb   
2014-09-25 11:53   
Issue reproducible only in case the field does not have any value.
(0070399)
caristu   
2014-09-25 19:16   
(edited on: 2014-09-25 19:18)
Hi Shankar, I am able to reproduce it with value and setting the column as mandatory (see attached)

(0072005)
hgbot   
2014-11-25 19:25   
Repository: erp/devel/pi
Changeset: 02f377fd13c624219b12b51e05d6f82d4a9a7d53
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Tue Nov 25 19:04:33 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/02f377fd13c624219b12b51e05d6f82d4a9a7d53 [^]

Fixes issue 27670: Time fields do not have the correct style in read only mode

The problem was the following. Absolute and Standard time fields did not have the
correct style in read only mode.

It has been resolved adding a method that applies correct style in read only mode,
it means, it has been added "Disabled" at the end of style name in read only mode.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
---
(0072129)
alostale   
2014-11-28 12:59   
code review:
-prevent extra if nesting by using
   if () {
     ...
   } else if () {
     ...
   }
 istead of
   if () {
     ...
   } else {
     if () {
       //unnecessary nesting
     }
   }
  
-OB coding convention: use single quotes for JavaScript strings [1]: "Disabled" should be 'Disabled'


not reopening it as they are minor style issues.

[1] http://wiki.openbravo.com/wiki/JavaScript_Coding_Conventions#Single_Quotes [^]
(0072135)
hgbot   
2014-11-28 14:05   
Repository: erp/devel/pi
Changeset: ba175225033f84b8cff0804c28c2b6755395dcb4
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Fri Nov 28 14:04:22 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ba175225033f84b8cff0804c28c2b6755395dcb4 [^]

Related issue 27670: Added two small refactoring.

It has been prevented an extra if. Besides, it has been used OB coding
convection using single quotes.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
---
(0072184)
alostale   
2014-12-01 12:09   
Reopening:

Though the readonly UI looks fine, it is still possible to edit time and absolute time references when they are read only.
(0072382)
inigosanchez   
2014-12-10 11:40   
It has been resolved in attached export file.
(0072395)
alostale   
2014-12-10 13:24   
(edited on: 2014-12-10 13:25)
Testing attached export.

2 problems found:


                                  | UI | can't edit
----------------------------------------------------------------------
1. Read Only Role access | OK | OK
2. Non editable org | FAIL: text box | OK
3. Read only window (in AD) | OK | OK
4. Read only field (in AD) | OK | OK
5. Read only logic | FAIL: text box | OK

(0072455)
hgbot   
2014-12-12 14:56   
Repository: erp/devel/pi
Changeset: 1339ca00c158f8c91108a2f63a0b031efdc85d0a
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Dec 12 14:44:04 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1339ca00c158f8c91108a2f63a0b031efdc85d0a [^]

fixed bug 27670: time refrerence has no correct style when it is readonly

  The problem is caused by the incorrect management SC client does for styles in
  this case. TimeItem contains an inner TextItem. In case the TimeItem defines a
  textBoxStyle property, it is always applied to the inner TextItem without considering
  if it is active.

  Current fix overwrites SC default behavior so that is taken into account.

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
---
(0072457)
alostale   
2014-12-12 15:01   
Tested with all time references (time, date-time, absolute time, absolute date-time), with mandatory and non-mandatory fields, disabling the fields in different manners: by readonly field (AD), read only logic, read only access at role level, non editable org.
(0072547)
dbaz   
2014-12-16 13:49   
Several problems detected: In priority order

1) If there is an issue identified in the Smartclient side, it should be reported to Smartclient.
In the same way we invest a lot of time ensuring that known regressions doesn't happen again, we should ensure that it doesn't happen the first time.
Doing fixes like this in our side have demonstrated that is a bomb once we decide to upgrade the Smartclient library, so at least in a first action should be report it to them and try to backport the fix. Only if this solution is not feasible should we try to do the fix in our side.

2) https://code.openbravo.com/erp/devel/pi/rev/1339ca00c158f8c91108a2f63a0b031efdc85d0a#l1.19 [^]
A proper solution would be
return me.getClass().getInstanceProperty('textBoxStyle') + (me.isDisabled() ? 'Disabled' : (me.required ? 'Required' : ''));
With this we ensure that if we create a child class of OBTimeItem with its own styles, at this point they will not be overwritten by this code.

3) https://code.openbravo.com/erp/devel/pi/rev/1339ca00c158f8c91108a2f63a0b031efdc85d0a#l1.17 [^]
OB.Styles.OBFormField.OBTimeItem it seems that is 'undefined'
Anyway, here it is the same conflict than in the point before: it makes impossible create a new OBTimeItem child with its own new style.

4) Install "org.openbravo.platform.features" module
Go to "EM_Obpf_Stdtime" and "EM_Obpf_Abs_Time" columns of "C_Order" table and set "true" in "Read Only Logic" field.
Save and do "ant smartbuild"
Go to Sales Order window
Notice that although the "Absolute Time" and "Relative Time" look like read-only, you can write in them

At this point I have not developed more tests.
(0072566)
alostale   
2014-12-16 16:41   
Reported to SC http://forums.smartclient.com/showthread.php?p=127434 [^]
(0072569)
hgbot   
2014-12-16 17:24   
Repository: erp/devel/pi
Changeset: 87a7c215c8263c417f957a4f1672b90a69e475c2
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Dec 16 17:23:54 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/87a7c215c8263c417f957a4f1672b90a69e475c2 [^]

fixed bug 27670: time refrerence has no correct style when it is readonly

  -refactored previous solution to be easier to extend:
     -no hardcoded class references (OBTimeItem)
     -using changeDefaults instead of modifying init method
  -fixed editable field with readonly ui for readonly logic

---
M modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
---
(0072636)
dbaz   
2014-12-17 13:25   
Tested @ changeset 25557 - 87a7c215c826
(0073141)
hudsonbot   
2014-12-30 23:26   
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/6525fe229e06 [^]
Maturity status: Test
(0073154)
hudsonbot   
2014-12-30 23:26   
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/6525fe229e06 [^]
Maturity status: Test
(0073212)
hudsonbot   
2014-12-30 23:27   
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/6525fe229e06 [^]
Maturity status: Test
(0073224)
hudsonbot   
2014-12-30 23:27   
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/6525fe229e06 [^]
Maturity status: Test