From 8226b5ecd3afba3817d86e4f6896b9766f06910d Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 10 Sep 2024 19:40:49 +0000 Subject: [PATCH] Bug 37883: Adjust template for new system preference To test: 0. Apply patch, restart_all, and regenerate CSS ( https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_interface ) I also recommend clearing your browser cache. 1. Search fof the FilterSearchResultsByLoggedInBranch system preference and set it to 'Do'. 2. Do a catalog search and notice the 'Show local items only' button above the "Location" column. 3. Click it to show information ( in that column ) that is only related to the branch you are currently logged in at. 4. In the same result set have some items that are checked out, withdrawn, lost, damaged, and notforlaon. 5. Play more with the search results and ensure everything is accurate. 6. Set the FilterSearchResultsByLoggedInBranch system preference to 'Don't' and confirm that there is no button to filter by branch anymore. Signed-off-by: Brendan Lawlor --- .../prog/en/modules/catalogue/results.tt | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 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 5aff1e6cb60..fb630a2ce22 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -447,7 +447,9 @@
[% INCLUDE 'page-numbers.inc' %] - + [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %] + + [% END %]
[% IF ( searchdesc ) %] [% FOREACH QUERY_INPUT IN QUERY_INPUTS %] @@ -608,7 +610,7 @@ [% END %]
[% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount | html %] available:[% ELSE %], None available[% END %]
- [% IF SEARCH_RESULT.branchtotalcount > 0 %] + [% IF ( SEARCH_RESULT.branchtotalcount > 0 ) && Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
[% tnx('{count} item', '{count} items', SEARCH_RESULT.branchtotalcount, {count = SEARCH_RESULT.branchtotalcount}) | html %][% IF ( SEARCH_RESULT.branchavailablecount ) %], [% SEARCH_RESULT.branchavailablecount | html %] available:[% ELSE %], None available[% END %]
[% END %] @@ -623,12 +625,16 @@ [% IF status_count == "onloancount" %] [% IF SEARCH_RESULT.${status_count} > 0 %]
[% SEARCH_RESULT.${status_count} | html %] checked out:
-
[% SEARCH_RESULT.branchonloancount | html %] checked out:
+ [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %] +
[% SEARCH_RESULT.branchonloancount | html %] checked out:
+ [% END %] [% END %] [% ELSIF status_count == "othercount" %] [% IF SEARCH_RESULT.${status_count} > 0 %]
[% SEARCH_RESULT.${status_count} | html %] unavailable:
-
[% SEARCH_RESULT.branchothercount | html %] unavailable:
+ [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %] +
[% SEARCH_RESULT.branchothercount | html %] unavailable:
+ [% END %] [% END %] [% END %] [% IF SEARCH_RESULT.${items_loop}.size > 0 %] @@ -711,7 +717,7 @@ No items [% END %] [% END # /IF ( SEARCH_RESULT.items_count ) %] - [% IF SEARCH_RESULT.branchtotalcount == 0 %] + [% IF SEARCH_RESULT.branchtotalcount == 0 && Koha.Preference('FilterSearchResultsByLoggedInBranch') %] No items [% END %]
@@ -799,16 +805,18 @@ var holdforclub = "[% holdforclub | html %]"; var userbranch = "[% userbranch | html %]"; - $('#toggleitems').click( function() { - $('#toggleitems').text() === 'Show local items only' ? $('#toggleitems').text("Show items in all libraries") : $('#toggleitems').text("Show local items only"); - $('.branch_specific').toggle(); - $('.all').toggle(); - $('ul[class*="_loop_items"] li').each( function() { - if ( !$(this).hasClass(userbranch) ) { - $(this).toggle(); - } + [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %] + $('#toggleitems').click( function() { + $('#toggleitems').text() === 'Show local items only' ? $('#toggleitems').text("Show items in all libraries") : $('#toggleitems').text("Show local items only"); + $('.branch_specific').toggle(); + $('.all').toggle(); + $('ul[class*="_loop_items"] li').each( function() { + if ( !$(this).hasClass(userbranch) ) { + $(this).toggle(); + } + }); }); - }); + [% END %] [% IF SEARCH_RESULTS %] var SEARCH_RESULTS = 1; [% ELSE %] -- 2.39.5