Bugzilla – Attachment 166148 Details for
Bug 27363
Restore temporary selection of Z39.50 targets throughout multiple searches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27363: Restore temporary selection of Z39.50 targets throughout multiple searches
Bug-27363-Restore-temporary-selection-of-Z3950-tar.patch (text/plain), 4.77 KB, created by
Owen Leonard
on 2024-05-03 15:12:27 UTC
(
hide
)
Description:
Bug 27363: Restore temporary selection of Z39.50 targets throughout multiple searches
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-05-03 15:12:27 UTC
Size:
4.77 KB
patch
obsolete
>From b012c3f044102585522a331ace2f014c1063050d Mon Sep 17 00:00:00 2001 >From: Phil Ringnalda <phil@chetcolibrary.org> >Date: Thu, 2 May 2024 16:19:17 -0700 >Subject: [PATCH] Bug 27363: Restore temporary selection of Z39.50 targets > throughout multiple searches >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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> >--- > koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >index 13855ec6e2..c767a21212 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc >@@ -445,7 +445,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > function showAdvancedSearch() { > $('#advanced-search-servers').empty(); > $.each( z3950Servers, function( index, server ) { >- $('#advanced-search-servers').append( '<li data-server-id="' + index + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + '</label></li>' ); >+ $('#advanced-search-servers').append( '<li data-server-id="' + server.server_id + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + '</label></li>' ); > } ); > $('#advanced-search-ui').modal('show'); > } >@@ -507,7 +507,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > num_fetched += '+'; > } > >- $('#search-serversinfo').append( '<li data-server-id="' + index + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + ' (' + num_fetched + ')' + '</label></li>' ); >+ $('#search-serversinfo').append( '<li data-server-id="' + server.server_id + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + ' (' + num_fetched + ')' + '</label></li>' ); > } ); > > var seenColumns = {}; >@@ -1285,7 +1285,8 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr > }); > > $( document ).on( 'change', 'input.search-toggle-server', function() { >- var server = z3950Servers[ $( this ).closest('li').data('server-id') ]; >+ const id = $( this ).closest('li').data('server-id'); >+ const server = z3950Servers.find(server => server.server_id === id); > server.checked = this.checked; > > if ( $('#search-results-ui').is( ':visible' ) && Search.Fetch() ) { >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27363
:
115437
|
115439
|
115440
|
115441
|
115442
|
166092
|
166148
|
166454