From fe97075e4b7e6f6e5e9f2dbe3f2a8cab277cd571 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 Signed-off-by: Lucas Gass (cherry picked from commit 580484e2dafe1431e9735977f84930239e5e37d0) Signed-off-by: Paul Derscheid --- 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 229e9a63d8..5777e8211e 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2038,6 +2038,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 434e8a1c18..d75f3daa54 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') %]