From 1bdee40cf031722e76a81876756f4e6d4f3be500 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 10 Dec 2025 17:16:33 +0000 Subject: [PATCH] Bug 41422: Fix I18N issue with FilterSearchResultsByLoggedInBranch To test: 1. Apply patch 2. Search fof the FilterSearchResultsByLoggedInBranch system preference and set it to 'Do'. 3. Do a catalog search and notice the 'Show local items only' button above the "Location" column. 4. Click it to show information ( in that column ) that is only related to the branch you are currently logged in at. 5. In the same result set have some items that are checked out, withdrawn, lost, damaged, and notforlaon. 6. Play more with the search results and ensure everything is accurate. 7. Set the FilterSearchResultsByLoggedInBranch system preference to 'Don't' and confirm that there is no button to filter by branch anymore. Signed-off-by: David Nind --- .../prog/en/modules/catalogue/results.tt | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index c04479af86..42f5bdc693 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -556,7 +556,10 @@
[% INCLUDE 'page-numbers.inc' %] [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %] - + [% END %]
[% IF ( searchdesc ) %] @@ -986,7 +989,12 @@ } }); $('#toggleitems').click( function() { - $('#toggleitems').text() === 'Show local items only' ? $('#toggleitems').text("Show items in all libraries") : $('#toggleitems').text("Show local items only"); + let this_toggle = $(this); + let show_all = this_toggle.data('mode') === 'all'; + + this_toggle.find('.when-local, .when-all').toggle(); + this_toggle.data('mode', show_all ? 'local' : 'all'); + $('.branch_specific').toggle(); $('.all').toggle(); $('ul[class*="_loop_items"] li').each( function() { @@ -994,11 +1002,11 @@ $(this).toggle(); } }); - $(this).toggleClass('show-local-items show-all-items'); - if ($(this).hasClass('show-local-items')) { - localStorage.setItem("show_local_items", 'all'); - } else { + + if (show_all) { localStorage.setItem("show_local_items", 'local'); + } else { + localStorage.setItem("show_local_items", 'all'); } }); [% END %] -- 2.39.5