From 1c58e5c23a61f234e42c16e4c20180d6f0d5487b Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 8 Dec 2015 15:10:46 +0000
Subject: [PATCH] Bug 15324: Do not display 'Waiting holds:" if no holds are
 waiting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Test plan:
- Make sure that you have a patron A with waiting holds and a patron B
  without waiting holds
- Go to the checkout page for patron A (Home > Circulation > Checkouts
> ...)
- At the right, there is a title "Waiting holds:" and a list of
  holds waiting
- Go to the checkout page for patron B
=> Without this patch "Waiting holds:" is displayed

Sign-off on Jonathan's patch
Signed-off-by: Marc Véron <veron@veron.ch>

http://bugs.koha-community.org/show_bug.cgi?id=14324
---
 circ/circulation.pl                                         |    3 ++-
 koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/circ/circulation.pl b/circ/circulation.pl
index f16475e..3da7f0d 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -457,9 +457,10 @@ if ($borrowernumber) {
 # show all reserves of this borrower, and the position of the reservation ....
 if ($borrowernumber) {
     my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } );
+    my $waiting_holds = $holds->waiting;
     $template->param(
         holds_count  => $holds->count(),
-        WaitingHolds => scalar $holds->waiting(),
+        WaitingHolds => $waiting_holds,
     );
 
     $template->param( adultborrower => 1 ) if ( $borrower->{category_type} eq 'A' || $borrower->{category_type} eq 'I' );
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index 19ba9fa..1c81636 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -797,7 +797,7 @@ No patron matched <span class="ex">[% message %]</span>
 			</ul>
         </div>
 
-            [% IF ( WaitingHolds ) %]
+            [% IF WaitingHolds.count %]
                 <div id="holdswaiting" class="circmessage">
                     <h4>Holds waiting:</h4>
                     [% FOREACH w IN WaitingHolds %]
-- 
1.7.10.4