Fixes issue 17136: You cannot enter to Menu window but an ugly error shows up
authorMartin Taal <martin.taal@openbravo.com>
Thu, 12 May 2011 15:46:33 +0200
changeset 12132 9121d767d7f3
parent 12131 33867e2a810b
child 12133 184bd464aefe
Fixes issue 17136: You cannot enter to Menu window but an ugly error shows up
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js	Thu May 12 15:41:09 2011 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view-datasource.js	Thu May 12 15:46:33 2011 +0200
@@ -155,8 +155,8 @@
       if (errorStatus) {
         var handled = this.view.setErrorMessageFromResponse(dsResponse, jsonData, dsRequest);
         
-        if (!handled && !dsRequest.willHandleError) {
-          OB.KernelUtilities.handleSystemException(error.message);
+        if (!handled && !dsRequest.willHandleError && jsonData.response && jsonData.response.error) { 
+          OB.KernelUtilities.handleSystemException(jsonData.response.error.message);
         }
       } else {
         // there are some cases where the jsonData is not passed, in case of
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Thu May 12 15:41:09 2011 +0200
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Thu May 12 15:46:33 2011 +0200
@@ -277,6 +277,17 @@
   }
 });
 
+// if not overridden then also errors handled by OB are shown in a popup
+// see https://issues.openbravo.com/view.php?id=17136
+isc.RPCManager.addClassProperties({
+  _handleError: isc.RPCManager.getPrototype().handleError,
+  handleError : function (response, request) {
+    if (!request.willHandleError) {
+      this._handleError(response, request);
+    }
+  }
+})
+
 // uncomment this code and put a breakpoint to get a better control
 // on from where async operations are started
 //isc.Class._fireOnPause = isc.Class.fireOnPause;