details:   https://code.openbravo.com/erp/devel/pi/rev/8fc80e4bb1fb
changeset: 26621:8fc80e4bb1fb
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Wed May 13 15:56:05 2015 +0200
summary:   Fixed issue 29561: 'Time' fields now can be set as readonly via 
AD_FIELD

diffstat:

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

diffs (43 lines):

diff -r d142537185dc -r 8fc80e4bb1fb 
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
        Wed May 13 13:50:58 2015 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js
        Wed May 13 15:56:05 2015 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -216,19 +216,22 @@
       }
       this.setValue(data[this.name]);
     }
-  },
-
-  setDisabled: function (disabled) {
-    // SC doesn't handle properly dynamically disabling timeItem, this 
temporary hack
-    // solves the problem by disabling/enabling inner textItem
-    //    see issue #27670
-    this.textField.setDisabled(disabled);
-    this.Super('setDisabled', arguments);
   }
 });
 
 isc.OBTimeItem.changeDefaults('textFieldDefaults', {
   getTextBoxStyle: function () {
+    // Changes in 'setDisable' in the parent item doesn't affect the text 
field (issue #29561)
+    // With this hack, each time the text box style should be retreived, we 
ensure also that
+    // the 'disable' state is in sync with the parent item.
+    // PS: It cannot be done by overwriting 'setDisable' in the parent item, 
because default
+    //     form states (and 'disabled: true'could be one of them), doesn't pass
+    //     through 'setDisabled' function.
+    if (this.parentItem.isDisabled() && !this.isDisabled()) {
+      this.setDisabled(true);
+    } else if (!this.parentItem.isDisabled() && this.isDisabled()) {
+      this.setDisabled(false);
+    }
     // SC does not handle properly styles for inner textItem representing the 
time,
     // this is a temporary hack till it is fixed in SC code
     //   see issue #27670

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to