[client-event-handlers] Use existing getDirtyEditForm() to detect changes
authorCarlos Aristu <carlos.aristu@openbravo.com>
Thu, 16 Jun 2016 09:20:49 +0200
changeset 29793 1ae3e064a1b5
parent 29792 9cfd2f44ff7a
child 29794 93a252909ec5
[client-event-handlers] Use existing getDirtyEditForm() to detect changes
There is no need to create a new hasChanges() function. The existing getDirtyEditForm() function can be used for the same purpose.
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-window.js	Wed Jun 15 19:51:48 2016 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-window.js	Thu Jun 16 09:20:49 2016 +0200
@@ -848,7 +848,7 @@
       isc.ask(OB.I18N.getLabel('OBUIAPP_AutosaveConfirm'), saveCallback);
     } else {
       // Auto save confirmation not required: continue as confirmation was accepted
-      if (this.hasChanges() && this.activeView.existsAction && this.activeView.existsAction('PRESAVE')) {
+      if (this.getDirtyEditForm() && this.activeView.existsAction && this.activeView.existsAction('PRESAVE')) {
         this.activeView.executePreSaveActions(function () {
           saveCallback(true);
         });
@@ -858,21 +858,6 @@
     }
   },
 
-  hasChanges: function () {
-    var editForm;
-    if (!this.activeView) {
-      return false;
-    }
-    if (this.activeView.isShowingForm) {
-      return this.activeView.viewForm.hasChanged;
-    }
-    editForm = this.activeView.viewGrid.getEditForm();
-    if (editForm) {
-      return editForm.hasChanged;
-    }
-    return false;
-  },
-
   callAutoSaveAction: function () {
     var action = this.autoSaveAction;
     this.cleanUpAutoSaveProperties();