From 2f9e8b2b6f467ac7c517f9407f1d54f4e211544b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 5 Mar 2024 16:04:04 +0100 Subject: [PATCH] Bug 36234: Fix 'languages' prefs selection MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test plan: Edit and save several types of sysprefs, reload the page to confirm they are correctly saved, or check their values in DB Signed-off-by: Christian Stelzenmüller Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index 2092dd8a68..cfda80a142 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -8,7 +8,13 @@ KOHA.Preferences = { return; } - let sysprefs = $(form).find('.modified').toArray().reduce((map, e) => ({ ...map, [$(e).attr('name')]: [$(e).val()].flat()}), {}); + let sysprefs = $(form).find('.modified').not('.preference-checkbox').toArray().reduce((map, e) => ({ ...map, [$(e).attr('name')]: [$(e).val()].flat()}), {}); + + // language prefs + $(form).find('.modified.preference-checkbox:checked').toArray().forEach((elt) => { + (sysprefs[$(elt).attr('name')] = sysprefs[$(elt).attr('name')] || []).push($(elt).val()); + }); + if ( !Object.keys(sysprefs).length ) { humanMsg.displayAlert( __("Nothing to save") ); return; -- 2.39.5