Bugzilla – Attachment 171407 Details for
Bug 37883
Add a filter for staff search results to filter by library
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37883: Add ability to filter search results location column by logged in location
Bug-37883-Add-ability-to-filter-search-results-loc.patch (text/plain), 8.54 KB, created by
Brendan Lawlor
on 2024-09-12 14:42:19 UTC
(
hide
)
Description:
Bug 37883: Add ability to filter search results location column by logged in location
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2024-09-12 14:42:19 UTC
Size:
8.54 KB
patch
obsolete
>From 6a648426183ec5bf15dda46f5f1bfd3d03aca264 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 10 Sep 2024 15:39:53 +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: Brendan Lawlor <blawlor@clamsnet.org> >--- > catalogue/search.pl | 3 ++ > .../prog/css/src/staff-global.scss | 7 ++++- > .../prog/en/modules/catalogue/results.tt | 30 +++++++++++++++---- > 3 files changed, 34 insertions(+), 6 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index ebb78bcfb6..8ecbe49e9a 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -198,6 +198,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 2bc5c5db27..38eb560b91 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -1942,7 +1942,6 @@ li { > > &.unavailable { > clear: left; >- display: block; > } > } > >@@ -1959,6 +1958,12 @@ 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 e2dcdb6ff8..95d0b1391c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -451,7 +451,7 @@ > > <div id="searchresults"> > [% INCLUDE 'page-numbers.inc' %] >- >+ <button href="#" id="toggleitems" class="btn btn-primary btn-xs" style="float: right;">Show local items only</button> > <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form"> > [% IF ( searchdesc ) %] > [% FOREACH QUERY_INPUT IN QUERY_INPUTS %] >@@ -611,7 +611,10 @@ > <span class="blocker inaccurate-item-statuses" title="Item statuses may be inaccurate. Please view the record details for accurate item statuses"> > [% END %] > >- [% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount | html %] <span>available:</span>[% ELSE %], <span>None available</span>[% END %] >+ <div class="all">[% tnx('{count} item', '{count} items', SEARCH_RESULT.items_count, {count = SEARCH_RESULT.items_count}) | html %][% IF ( SEARCH_RESULT.availablecount ) %], [% SEARCH_RESULT.availablecount | html %] <span>available:</span>[% ELSE %], <span>None available</span>[% END %]</div> >+ [% IF SEARCH_RESULT.branchtotalcount > 0 %] >+ <div class="branch_specific">[% tnx('{count} item', '{count} items', SEARCH_RESULT.branchtotalcount, {count = SEARCH_RESULT.branchtotalcount}) | html %][% IF ( SEARCH_RESULT.branchavailablecount ) %], [% SEARCH_RESULT.branchavailablecount | html %] <span>available:</span>[% ELSE %], <span>None available</span>[% END %]</div> >+ [% END %] > > [% IF MaxSearchResultsItemsPerRecordStatusCheck && SEARCH_RESULT.items_count > MaxSearchResultsItemsPerRecordStatusCheck %] > </span> >@@ -621,11 +624,13 @@ > [% BLOCK search_result_items %] > [% IF status_count == "onloancount" %] > [% IF SEARCH_RESULT.${status_count} > 0 %] >- <div class="results_checkedout">[% SEARCH_RESULT.${status_count} | html %] checked out:</div> >+ <div class="results_checkedout all">[% SEARCH_RESULT.${status_count} | html %] checked out:</div> >+ <div class="results_checkedout branch_specific">[% SEARCH_RESULT.branchonloancount | html %] checked out:</div> > [% END %] > [% ELSIF status_count == "othercount" %] > [% IF SEARCH_RESULT.${status_count} > 0 %] >- <div class="results_unavailable">[% SEARCH_RESULT.${status_count} | html %] unavailable:</div> >+ <div class="results_unavailablei all">[% SEARCH_RESULT.${status_count} | html %] unavailable:</div> >+ <div class="results_unavailablei branch_specific">[% SEARCH_RESULT.branchothercount | html %] unavailable:</div> > [% END %] > [% END %] > [% IF SEARCH_RESULT.${items_loop}.size > 0 %] >@@ -704,9 +709,12 @@ > [% END %] > </ul> > [% ELSE %] >- <span class="unavailable">No items</span> >+ <span class="unavailable all">No items</span> > [% END %] > [% END # /IF ( SEARCH_RESULT.items_count ) %] >+ [% IF SEARCH_RESULT.branchtotalcount == 0 %] >+ <span class="unavailable branch_specific">No items</span> >+ [% END %] > </div> <!-- /.availability --> > </td> > </tr> >@@ -816,6 +824,18 @@ > var biblionumber = "[% biblionumber | html %]"; > var holdfor_cardnumber = "[% holdfor_patron.cardnumber | html %]"; > 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 SEARCH_RESULTS %] > var SEARCH_RESULTS = 1; > [% ELSE %] >-- >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 37883
:
171256
|
171257
|
171261
|
171286
|
171287
|
171289
|
171291
|
171406
| 171407 |
171408
|
171409
|
171410
|
171411
|
176697
|
177306