From 405b8ade7f76e600dac2fa004c15ef2e752b8a5f Mon Sep 17 00:00:00 2001 From: Jan Kissig Date: Tue, 17 Mar 2026 09:32:52 +0000 Subject: [PATCH] Bug 28297: Allow syspref text fields to be saved when content changed to original value This fixes the behavior on changed system preferences in HTML input text fields. Preferences which are changed back to the original value can be saved now without reloading the system pref page. This will only affect input fields with type=text as they have the property defaultValue which is checked to highlight a field as 'modified'. Testplan: a) take a syspref with an HTML text input field f.e. AccessControlAllowOrigin b) write '*' into the iput field. Notice that the preference is marked 'modified'. Click 'save' c) now got to the text field again and delete that '*'. Notice the preference does not get marked as modified and can theefore not be saved. d) apply patch and reload page e) repeat b) and c) and notice that the preference gets marked 'modified' on both cases. Signed-off-by: David Nind Signed-off-by: Andrew Fuerste Henry Signed-off-by: Lucas Gass (cherry picked from commit 581c9b39bbd1501a63399adbb23b15338eef56f3) Signed-off-by: Jacob O'Mara --- koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js index bbe128f249..d65ed991e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js @@ -68,6 +68,10 @@ KOHA.Preferences = { $(form) .find(".modified") .each(function () { + // set defaultValue to changed value - enables re-saving when input changes back to initial value + if (this.defaultValue != undefined) { + this.defaultValue = this.value; + } var modified_pref = $(this).attr("id"); modified_pref = modified_pref.replace("pref_", ""); msg +=