Related to issue 24834: Transplant to Smartclient to fix the issue
authorDavid Baz Fayos <david.baz@openbravo.com>
Mon, 30 Sep 2013 12:09:46 +0200
changeset 21217 50c111e5cff8
parent 21216 63efb05b3449
child 21218 73df6c79ca82
child 21221 efb12cdf8699
Related to issue 24834: Transplant to Smartclient to fix the issue
instead of fixing the issue in our sources
modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/isomorphic/ISC_Combined.js
--- a/modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js	Mon Sep 30 11:59:36 2013 +0200
+++ b/modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js	Mon Sep 30 12:09:46 2013 +0200
@@ -197,33 +197,5 @@
       return true;
     }
     return this.Super('evaluateCriterion', arguments);
-  },
-
-  // SC's validateJSONRecord causes fields which value in the DataSource response
-  // is null to become in undefined. This method workarounds the problem until SC
-  // solves it in isc.DataSource.
-  //   see https://issues.openbravo.com/view.php?id=24834
-  //       http://forums.smartclient.com/showthread.php?p=110346#post110346
-  validateJSONRecord: function (record) {
-    var originalNulls = [],
-        validatedRecord, fieldNames = this.getFieldNames(),
-        i;
-
-    // save all fields which value was null in the JSON response
-    for (i = 0; i < fieldNames.length; i++) {
-      if (record[fieldNames[i]] === null) {
-        originalNulls.push(fieldNames[i]);
-      }
-    }
-
-    // SC converts nulls in undefined
-    validatedRecord = this.Super('validateJSONRecord', arguments);
-
-    // let's recover null values
-    for (i = 0; i < originalNulls.length; i++) {
-      validatedRecord[originalNulls[i]] = null;
-    }
-
-    return validatedRecord;
   }
 });
\ No newline at end of file
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/isomorphic/ISC_Combined.js	Mon Sep 30 11:59:36 2013 +0200
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/isomorphic/ISC_Combined.js	Mon Sep 30 12:09:46 2013 +0200
@@ -15137,7 +15137,7 @@
 ,isc.A.validateJSONRecord=function isc_DataSource_validateJSONRecord(_1){var _2=this.getFieldNames(),_3={};for(var i=0;i<_2.length;i++){var _5=_2[i],_6=this.getField(_5),_7;if(_6.valueXPath){_7=isc.xml.selectObjects(_1,_6.valueXPath,true)}else{_7=_1[_5]}
 if(_6.getFieldValue){if(!isc.isA.Function(_6.getFieldValue)){isc.Func.replaceWithMethod(_6,"getFieldValue","record,value,field,fieldName")}
 _7=_6.getFieldValue(_1,_7,_6,_5)}
-var _8;if(_7!=_8){var _9=isc.DS.get(_6.type);if(_9&&!(_9.skipJSONValidation)){if(!(isc.isAn.Array(_7))){_7=_9.validateJSONRecord(_7)}else{for(var i=0;i<_7.length;i++){_7[i]=_9.validateJSONRecord(_7[i])}}}
+var _8;if(_7!==_8){var _9=isc.DS.get(_6.type);if(_9&&!(_9.skipJSONValidation)){if(!(isc.isAn.Array(_7))){_7=_9.validateJSONRecord(_7)}else{for(var i=0;i<_7.length;i++){_7[i]=_9.validateJSONRecord(_7[i])}}}
 _3[_5]=this.validateFieldValue(_6,_7)}}
 if(this.dropExtraFields)return _3;for(var i=0;i<_2.length;i++){var _5=_2[i];_1[_5]=_3[_5]}
 return _1}