details:   https://code.openbravo.com/erp/devel/pi/rev/29bb5f2c713c
changeset: 25544:29bb5f2c713c
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Dec 10 11:28:43 2014 +0100
summary:   related to 27670: revert previous changes to fix this issue

  Previous changesets only worked when the item was initially disabled, but in
  case it was dinamically disabled (ie. readonly logic) this code was not
  executed and the style was not properly applied.

details:   https://code.openbravo.com/erp/devel/pi/rev/1339ca00c158
changeset: 25545:1339ca00c158
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Fri Dec 12 14:44:04 2014 +0100
summary:   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.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
 |  29 +++------
 1 files changed, 11 insertions(+), 18 deletions(-)

diffs (56 lines):

diff -r 14bcacd308af -r 1339ca00c158 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
        Fri Dec 12 12:56:00 2014 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
        Fri Dec 12 14:44:04 2014 +0100
@@ -58,17 +58,6 @@
     return newValue;
   },
 
-  setDisabled: function (disabled) {
-    if (disabled) {
-      this.previousStyleName = this.textBoxStyle;
-      this.textBoxStyle = this.textBoxStyle + 'Disabled';
-    } else if (this.textBoxStyle.endsWith('Disabled')) {
-      this.textBoxStyle = (this.previousStyleName || 
this.textBoxStyle.substring(0, this.textBoxStyle.length - 8));
-      delete this.previousStyleName;
-    }
-    this.Super('setDisabled', arguments);
-  },
-
   // make sure that the undo/save buttons get enabled, needs to be done like
   // this because changeOnKeypress is false. Activating changeOnKeypress makes 
the
   // item not editable as it is reformatted on keyStroke, the same happens 
calling
@@ -150,10 +139,20 @@
   },
 
   init: function () {
-    var oldShowHint, hint, formatDefinition = 
OB.Utilities.getTimeFormatDefinition();
+    var oldShowHint, hint, formatDefinition = 
OB.Utilities.getTimeFormatDefinition(),
+        me = this;
 
     this.timeFormat = formatDefinition.timeFormat;
 
+    // The TextItem within TimeItem that renders the value defines its 
properties in textFieldDefaults
+    // this cannot be customized till instance is created. In order to apply 
proper format, it requires
+    // to set the style and change the getTextBoxStyle which by default does 
not manage properly disabled
+    //   see issue #27670
+    isc.addProperties(this.textFieldDefaults, 
OB.Styles.OBFormField.OBTimeItem);
+    this.textFieldDefaults.getTextBoxStyle = function () {
+      return isc.OBTimeItem.getInstanceProperty('textBoxStyle') + 
(me.isDisabled() ? 'Disabled' : (me.required ? 'Required' : ''));
+    };
+
     this.Super('init', arguments);
 
     if (this.items && this.items[0]) {
@@ -164,12 +163,6 @@
       }
     }
 
-    if (this.isDisabled()) {
-      this.setDisabled(true);
-    } else {
-      this.setDisabled(false);
-    }
-
     if (this.showTimeGrid && this.form && !this.timeGrid) {
       oldShowHint = this.showHint;
       this.showHint = true;

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to