From f64b728b3194823fc8af12dc21bfa4567d70b7a6 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" --- .../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 8f311fa353..a63bd3feaa 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js +++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js @@ -10,9 +10,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.30.2