From 8c485d0df528d878f799edf502bfeda891c30d01 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 28 Sep 2016 15:28:17 +0000 Subject: [PATCH] Bug 14876 - Show number of holds per record on the search results MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch edits catalogue/search.pl to pass back the count of holds along with other data for display in results.tt To test: 1 - Search in staff 2 - Note holds link has no extra information 3 - Apply patch 4 - Do search in staff that returns records with some holds (i.e. place some holds) 5 - Note the number of holds now displays next to the text of the link: Holds (#) Signed-off-by: Marc VĂ©ron --- catalogue/search.pl | 3 +++ koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 5855bf1..1afd7c9 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -155,6 +155,7 @@ use Koha::LibraryCategories; use Koha::Virtualshelves; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; +use Koha::Holds; use URI::Escape; @@ -613,6 +614,8 @@ for (my $i=0;$i<@servers;$i++) { if ( grep {$_ eq $line->{'biblionumber'}} @cart_list) { $line->{'incart'} = 1; } + # also, let's get the number of holds here + $line->{holdscount} = Koha::Holds->count( { biblionumber => $line->{biblionumber} } ); } $template->param(SEARCH_RESULTS => \@newresults); ## FIXME: add a global function for this, it's better than the current global one 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 3cecf8a..3e8b8b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -587,7 +587,7 @@ var holdForPatron = function () { [% IF ( SEARCH_RESULT.norequests ) %] No holds allowed [% ELSE %] - Holds + Holds ([% SEARCH_RESULT.holdscount %]) [% IF ( holdfor ) %] | Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])[% END %] [% END %] -- 2.1.4