]> git.koha-community.org Git - koha.git/commit
Bug 27363: Restore temporary selection of Z39.50 targets throughout multiple searches
authorPhil Ringnalda <phil@chetcolibrary.org>
Thu, 2 May 2024 23:19:17 +0000 (16:19 -0700)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 28 May 2024 21:59:04 +0000 (21:59 +0000)
commit300b83fb2ee0a3b52dea97ac236bab3a571089fe
tree641adef7cf324a0e12a4d4e1804fac4bf7412cbd
parentee14606029f8ad954c52a3fcdded449754564f8c
Bug 27363: Restore temporary selection of Z39.50 targets throughout multiple searches

The advanced editor currently saves which Z39.50 servers are selected
in local storage using the index in the sorted array of servers, and
then misreads them back as though they were server_ids. We want them to
be server_ids, since that's immutable and the index can change with
changes in rank or server name.

We use the data-server-id property in the HTML more often as a server_id
than as the index that's currently stored there, so this patches
switches it back to be the server_id, and in the one place we would use
the index, instead uses Array.find to just get the server object instead
of referencing it by index.

Test plan:
 1. Set the preference EnableAdvancedCatalogingEditor to enable
 2. Administration - Z39.50 Servers, for NATIONAL LIBRARY OF FRANCE
    uncheck "Preselected"
 3. To be sure you don't have confusing saved preferences, open
    Firefox's Developer Tools, in the Storage tab open Local Storage and
    select your URL
 4. In the row for cateditor_preferences_{your Koha user id}, if there
    are any values for selected_search_targets, delete them so you
    have "selected_search_targets":{}
 5. Open the advanced editor, and click "Advanced »" in the search box
 6. You should have Local catalog unchecked, LIBRARY OF CONGRESS checked
    because it is preselected, and NATIONAL LIBRARY OF FRANCE unchecked
 7. Toggle each checkbox so Local catalog and France are selected, and
    LoC is unselected.
 8. In a new broser tab, open the advanced editor, and click "Advanced »"
 9. You will see Local catalog unchecked, LoC checked, and France
    unchecked.
    That's the bug.
10. Apply patch, open the advanced editor in a new tab, click "Advanced »"
11. Toggle the checkboxes so Local catalog and France are selected, and
    LoC is not selected.
12. Open the advanced editor in another new tab, click "Advanced »"
13. You should see what you just set, Local catalog and France checked,
    and LoC unchecked, That's the correct behavior.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit a8f4fe946cbafd46621a7a94812580ce0104fe7e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 268e6bf0ff717e18ccb79b1d3a5fe2c38a300b88)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc