[client-event-handlers] Minor refactor to use new existsAction function
authorCarlos Aristu <carlos.aristu@openbravo.com>
Wed, 15 Jun 2016 18:27:45 +0200
changeset 29790 c918bb5c287b
parent 29789 0b4f4281338d
child 29791 82937b40e3da
[client-event-handlers] Minor refactor to use new existsAction function
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Tue Jun 14 19:47:01 2016 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Jun 15 18:27:45 2016 +0200
@@ -2126,6 +2126,16 @@
     }
   },
 
+  existsAction: function (actionType) {
+    return this.tabId && OB.EventHandlerRegistry.hasAction(this.tabId, actionType);
+  },
+
+  callSaveActions: function (actionType, extraParameters, callback) {
+    if (this.existsAction(actionType)) {
+      OB.EventHandlerRegistry.call(this.tabId, actionType, this, this.viewForm, this.viewGrid, extraParameters, callback);
+    }
+  },
+
   deleteSelectedRows: function (autoSaveDone) {
     var msg, dialogTitle, view = this,
         deleteCount, callback, currentGrid;
@@ -3055,12 +3065,5 @@
     });
 
     return result;
-  },
-
-  callSaveActions: function (actionType, extraParameters, callback) {
-    if (this.tabId && OB.EventHandlerRegistry.hasAction(this.tabId, actionType)) {
-      OB.EventHandlerRegistry.call(this.tabId, actionType, this, this.viewForm, this.viewGrid, extraParameters, callback);
-    }
   }
-
 });
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js	Tue Jun 14 19:47:01 2016 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js	Wed Jun 15 18:27:45 2016 +0200
@@ -858,7 +858,7 @@
     if (!action) {
       return;
     }
-    if (this.view && OB.EventHandlerRegistry.hasAction(this.view.tabId, 'POSTSAVE')) {
+    if (this.view && this.view.existsAction && this.view.existsAction('POSTSAVE')) {
       // If there exists post-save actions, the auto save action will be fired right after them
       return;
     }