From 5a6e7a6ffbab8e42e706486b9e75abe782a696b8 Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Mon, 18 Jul 2016 16:31:20 -0600 Subject: [PATCH] Bug 19267: Rancor - Warn before leaving page if record modified To test: 1 - Open the advanced editor 2 - Make some changes to a record 3 - Click on 'Patrons' or leave the page in some way 4 - Note there is no warning and changes are not saved 5 - Apply patch 6 - Open the advanced editor 7 - Make some changes 8 - Leave the page 9 - Note you get a warning of unsaved changes and can stay on the page Signed-off-by: Charles Farmer Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index a6ac276afa..62f19b0c97 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -1077,6 +1077,13 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr return false; } ); + window.onbeforeunload = function() { + if(editor.modified ) + { return 1; } + else + { return undef; } + }; + // Start editor Preferences.Load( [% USER_INFO.borrowernumber || 0 %] ); displayPreferences(editor); -- 2.39.5