[Bug 43215] New: Checkbox/sortable system preferences show one 'Saved preference' message per option instead of per preference
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 Bug ID: 43215 Summary: Checkbox/sortable system preferences show one 'Saved preference' message per option instead of per preference Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: System Administration Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com Depends on: 42553 Target Milestone: --- Found while testing bug 42553 (multiple_sortable: authval dispatcher for admin/preferences.pl). When a system preference uses the multiple_sortable (checkbox-group) widget in admin/preferences.pl - e.g. OPACAuthorIdentifiersAndInformation, ArticleRequestsSupportedFormats, or a new authval-sourced pref such as the one added by bug 42553 - saving the preference from Administration > System preferences pops up one "Saved preference ..." confirmation line per checkbox/option, instead of a single line for the preference itself. For example, saving a pref called TestSortableAV with two selected authorised values produces: Saved preference TestSortableAV_CASH Saved preference TestSortableAV_SIP00 Root cause: in koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js, the ".preference-checkbox" change handler marks every checkbox of every checkbox-group preference on the page as "modified" (not just the ones belonging to the changed preference), and dragging an item in the SortableJS list synthetically fires change() on the list's first checkbox, triggering the same global marking. KOHA.Preferences.Success() then builds the confirmation message by iterating every ".modified" element and using its own DOM id (which is per-checkbox, e.g. pref_TestSortableAV_CASH), rather than grouping by the underlying preference name. This is pre-existing behaviour, reproducible today on main with the existing checkbox-group prefs. It is not introduced by bug 42553, but that patch makes the widget easier to reach for new prefs, which is how it was noticed during QA. Test plan: 1. On a system with a multiple_sortable/checkbox-group syspref (e.g. OPACAuthorIdentifiersAndInformation), select two or more checkboxes and save. 2. Note the confirmation message contains one "Saved preference ..." line per checkbox rather than one line for the preference. 3. Expected: a single confirmation line per changed preference, regardless of how many checkboxes/options it contains. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42553 [Bug 42553] preferences.pl: Allow 'multiple_sortable' to use 'authval' source for dynamic choices -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 202895 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202895&action=edit Bug 43215: preferences.js: Report one save confirmation per preference, not per checkbox option Checkbox-group system preferences (multiple_sortable, ill_backends, and the OPAC/staff interface language selectors) render one checkbox per option. All the checkboxes for a given preference share its 'name' attribute, but each has its own unique 'id'. Saving such a preference produced one "Saved preference ..." confirmation line per checkbox instead of a single line for the preference as a whole, because KOHA.Preferences.Success() built the message from each modified element's 'id' rather than its 'name'. A related issue: the checkbox 'change' handler marked every '.preference-checkbox' on the whole page as modified, regardless of which preference it belonged to. This meant editing one checkbox-group preference silently re-saved (and, before this patch, also reported as saved) any other checkbox-group preference sharing the same tab - for example, editing OPACLanguages would also touch the unrelated StaffInterfaceLanguages preference on the I18N/L10N tab. This patch: * Scopes the 'modified' marking to checkboxes sharing the same preference name, so unrelated checkbox-group preferences on the same tab are left alone. * Groups the save confirmation message by preference name (deduplicated), so each preference produces exactly one "Saved preference" line regardless of how many options it has. Test plan: 1. Go to Administration > System preferences and search for OPACAuthorIdentifiersAndInformation. 2. Select two or more identifier types and click Save. 3. Confirm the confirmation banner shows a single "Saved preference OPACAuthorIdentifiersAndInformation" line, not one per selected identifier. 4. Drag one of the selected items to reorder it, click Save again, confirm you still get only one confirmation line, then reload the page and confirm the new order was kept. 5. Go to Administration > System preferences > I18N/L10N tab. 6. Toggle one of the checkboxes under "Enable the following languages on the OPAC" (OPACLanguages) and click Save. 7. Confirm the confirmation only reports OPACLanguages as saved - the staff interface language list (StaffInterfaceLanguages) should not appear in the message. 8. Reload the page and confirm the staff interface language selection is unchanged. 9. As a sanity check, modify an ordinary non-checkbox preference (e.g. a free text or yes/no preference) and confirm it still reports exactly one "Saved preference" line, same as before this patch. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #202895|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 --- Comment #2 from David Nind <david@davidnind.com> --- Created attachment 202962 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=202962&action=edit Bug 43215: preferences.js: Report one save confirmation per preference, not per checkbox option Checkbox-group system preferences (multiple_sortable, ill_backends, and the OPAC/staff interface language selectors) render one checkbox per option. All the checkboxes for a given preference share its 'name' attribute, but each has its own unique 'id'. Saving such a preference produced one "Saved preference ..." confirmation line per checkbox instead of a single line for the preference as a whole, because KOHA.Preferences.Success() built the message from each modified element's 'id' rather than its 'name'. A related issue: the checkbox 'change' handler marked every '.preference-checkbox' on the whole page as modified, regardless of which preference it belonged to. This meant editing one checkbox-group preference silently re-saved (and, before this patch, also reported as saved) any other checkbox-group preference sharing the same tab - for example, editing OPACLanguages would also touch the unrelated StaffInterfaceLanguages preference on the I18N/L10N tab. This patch: * Scopes the 'modified' marking to checkboxes sharing the same preference name, so unrelated checkbox-group preferences on the same tab are left alone. * Groups the save confirmation message by preference name (deduplicated), so each preference produces exactly one "Saved preference" line regardless of how many options it has. Test plan: 1. Go to Administration > System preferences and search for OPACAuthorIdentifiersAndInformation. 2. Select two or more identifier types and click Save. 3. Confirm the confirmation banner shows a single "Saved preference OPACAuthorIdentifiersAndInformation" line, not one per selected identifier. 4. Drag one of the selected items to reorder it, click Save again, confirm you still get only one confirmation line, then reload the page and confirm the new order was kept. 5. Go to Administration > System preferences > I18N/L10N tab. 6. Toggle one of the checkboxes under "Enable the following languages on the OPAC" (OPACLanguages) and click Save. 7. Confirm the confirmation only reports OPACLanguages as saved - the staff interface language list (StaffInterfaceLanguages) should not appear in the message. 8. Reload the page and confirm the staff interface language selection is unchanged. 9. As a sanity check, modify an ordinary non-checkbox preference (e.g. a free text or yes/no preference) and confirm it still reports exactly one "Saved preference" line, same as before this patch. Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43215 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com Text to go in the| |This fixes the messages release notes| |shown when saving changes | |to system preferences that | |use the widget with | |multiple sortable and | |selectable options that | |have checkboxes, such as | |OPACAuthorIdentifiersAndInf | |ormation. | | | |Saving changes to system | |preferences that used this | |widget resulted in several | |pops up with "Saved | |preference ..." with one | |confirmation line per | |checkbox/option (even if | |only one option was | |changed), instead of a | |single line for the | |preference itself. --- Comment #3 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. To add a language to test OPACLanguages: koha-translate --install de-DE --dev kohadev 2. To tidy up afterwards: koha-translate --remove de-DE --dev kohadev git clean -fd Result: a git status should show things are clean cd misc/translator/po, then: git status git fetch origin git reset --hard origin/main git clean -fd -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org