From fb38b1a8e88086b904b6b15039651a4158ac0a7c 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 This patch edits C4/Search.pm 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 (#) --- C4/Search.pm | 2 ++ koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/C4/Search.pm b/C4/Search.pm index a1296f9..b216946 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -23,6 +23,7 @@ use C4::Biblio; # GetMarcFromKohaField, GetBiblioData use C4::Koha; # getFacets use Koha::DateUtils; use Koha::Libraries; +use Koha::Holds; use Lingua::Stem; use C4::Search::PazPar2; use XML::Simple; @@ -2247,6 +2248,7 @@ sub searchResults { $oldbiblio->{onholdcount} = $item_onhold_count; $oldbiblio->{orderedcount} = $ordered_count; $oldbiblio->{notforloancount} = $notforloan_count; + $oldbiblio->{holdscount} = Koha::Holds->count( { biblionumber => $oldbiblio->{biblionumber} } ); if (C4::Context->preference("AlternateHoldingsField") && $items_count == 0) { my $fieldspec = C4::Context->preference("AlternateHoldingsField"); 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