From 0f911f77b36a65b6b970e372f4f7f567b9d5de38 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 25 Jun 2024 09:41:58 +0200 Subject: [PATCH] Bug 31610: Set messaging preferences only on "add_form" Signed-off-by: Olivier V --- .../intranet-tmpl/prog/js/messaging-preference-form.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js index 06d8067b0d..8a1950c29c 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js +++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js @@ -8,9 +8,13 @@ $(document).ready(function(){ message_prefs_dirty = true; // unless op=add consider the message prefs dirty } - if( $("#messaging_prefs_loading").length ){ // This element only appears in the template if op=add + if ( $("#messaging_prefs_loading").length ) { $('#categorycode_entry').change(() => { update_messaging_prefs() }); - update_messaging_prefs(); + + const searchParams = new URLSearchParams(location.search); + if (searchParams.has('op', 'add_form')) { + update_messaging_prefs(); + } function update_messaging_prefs () { var messaging_prefs_loading = $("#messaging_prefs_loading"); -- 2.34.1