Bug 14876 - Show number of holds per record on the search results
authorNick Clemens <nick@bywatersolutions.com>
Mon, 31 Oct 2016 14:39:40 +0000 (14:39 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 16 Dec 2016 11:37:30 +0000 (11:37 +0000)
This patch sues the existing plugin
Koha::Template::Plugin::Biblio->HoldsCount

To be consistent with current behaviour 'Holds (0)' is shown when
no holds have been placed on an item

To test:
1 - Search in staff
2 - Note holds link has no extra information
3 - Apply patch
4 - prove -v t/db_dependent/Template/Plugin/Holds.t
5 - Do search in staff that returns records with some holds (i.e. place
                some holds)
6 - Note the number of holds now displays next to the text of the link:
    Holds (#)

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt

index 031c1f8..0b3c2d3 100644 (file)
@@ -1,4 +1,5 @@
 [% USE Koha %]
+[% USE Biblio %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Catalog &rsaquo; [% IF ( searchdesc ) %]Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %][% ELSE %]You did not specify any search criteria[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -587,7 +588,7 @@ var holdForPatron = function () {
                             [% IF ( SEARCH_RESULT.norequests ) %]
                                 <span class="noholdstext">No holds allowed</span>
                             [% ELSE %]
-                                <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds</a>
+                                <a id="reserve_[% SEARCH_RESULT.biblionumber %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Holds ([% Biblio.HoldsCount( SEARCH_RESULT.biblionumber ) %])</a>
                                 [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]&amp;findborrower=[% holdfor_cardnumber %]">Place hold for [% holdfor_firstname %] [% holdfor_surname %] ([% holdfor_cardnumber %])</a></span>[% END %]
                             [% END %]