Related to issue 21533: Fix refactored to detect if input is a function
authorAugusto Mauch <augusto.mauch@openbravo.com>
Fri, 07 Sep 2012 14:40:32 +0200
changeset 17888 c60e1cf42d3b
parent 17887 d719d893fa76
child 17889 e535615e67aa
Related to issue 21533: Fix refactored to detect if input is a function

The code has been refactored, so that if the input is a function is executes it, while if it is not a function, it tries to decode using isc.JSON.decode.
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Fri Sep 07 17:05:42 2012 +0530
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Fri Sep 07 14:40:32 2012 +0200
@@ -2069,12 +2069,10 @@
         OB.Utilities.fixNull250(currentValues);
 
         try {
-          if (this.originalShowIf === 'true') {
-            originalShowIfValue = true;
-          } else if (this.originalShowIf === 'false') {
-            originalShowIfValue = false;
+          if (isc.isA.Function(this.originalShowIf)) {
+            originalShowIfValue = this.originalShowIf(item, value, form, currentValues, context);
           } else {
-            originalShowIfValue = this.originalShowIf(item, value, form, currentValues, context);
+            originalShowIfValue = isc.JSON.decode(this.originalShowIf);
           }
         } catch (_exception) {
           isc.warn(_exception + ' ' + _exception.message + ' ' + _exception.stack);