Fixes issue 9295: Remove prompt confirmation when click a button and has no user changes
authorIván Perdomo <ivan.perdomo@openbravo.com>
Mon, 08 Jun 2009 13:54:56 +0200
changeset 3983 449b220a5301
parent 3982 97e2fba62f90
child 3984 90b4171ab320
Fixes issue 9295: Remove prompt confirmation when click a button and has no user changes
web/js/utils.js
--- a/web/js/utils.js	Mon Jun 08 13:54:55 2009 +0200
+++ b/web/js/utils.js	Mon Jun 08 13:54:56 2009 +0200
@@ -335,14 +335,14 @@
 		var promptConfirmation = typeof top.appFrame.confirmOnChanges == 'undefined' ? true : top.appFrame.confirmOnChanges;
 		var hasUserChanges = typeof top.appFrame.isUserChanges == 'undefined' ? false : top.appFrame.isUserChanges;
 		if (form.inpLastFieldChanged && (hasUserChanges || isButtonClick || isTabClick)) { // if the inpLastFieldChanged exists and there is a user change
-			var autoSave = true;		
-			if (promptConfirmation) {
-				autoSave = showJSMessage(25);
-				if(typeof top.appFrame.confirmOnChanges != 'undefined' && autoSave) {
+			var autoSaveFlag = autosave;		
+			if (promptConfirmation && hasUserChanges) {
+				autoSaveFlag = showJSMessage(25);
+				if(typeof top.appFrame.confirmOnChanges != 'undefined' && autoSaveFlag) {
 					top.appFrame.confirmOnChanges = false;
 				}
 			}
-			if (autoSave) {
+			if (autoSaveFlag) {
 				if(form.autosave) {
 					form.autosave.value = 'Y';
 				}