From d9bbf3b44c74671e1f8b62a6c4fe1f3f6ebc7011 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 26 Feb 2025 23:07:56 +0000 Subject: [PATCH] Bug 37883: Add ability to filter search results location column by logged in location To test: 1. 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. 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. Signed-off-by: Laura_Escamilla --- catalogue/search.pl | 3 +++ .../prog/css/src/staff-global.scss | 8 ++++++++ .../prog/en/modules/catalogue/results.tt | 17 ++++++++++------- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index a22b9da42c..03f746c5f1 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -200,6 +200,9 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $lang = C4::Languages::getlanguage($cgi); +my $userenv_branch = C4::Context->userenv->{'branch'} || ''; +$template->param( userbranch => $userenv_branch ); + if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { $template->param( 'UNIMARC' => 1 ); } diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index ae6c2b9739..2dc855ab3d 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2024,6 +2024,14 @@ li { display: block; } } + + .all { + display: block; + } + + .branch_specific { + display: none; + } } #searchresults, 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 cca6a4c17f..72cbc5fa7b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -773,12 +773,15 @@ [% ELSE %] , None available [% END %] - - [% ELSE %] - [% 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 + + [% IF SEARCH_RESULT.branchtotalcount > 0 %] +
+ [% 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 %] [% END %] @@ -875,7 +878,7 @@ [% END %] [% ELSE %] - No items + No items [% END %] [% END # /IF ( SEARCH_RESULT.items_count ) %] [% IF SEARCH_RESULT.branchtotalcount == 0 && Koha.Preference('FilterSearchResultsByLoggedInBranch') %] -- 2.39.5