Bug 31902: Next header row inside a thead
[koha-ffzg.git] / opac / opac-recall.pl
index 779a126..2a8b249 100755 (executable)
@@ -23,7 +23,7 @@ use C4::Auth qw( get_template_and_user );
 use C4::Output qw( output_html_with_http_headers );
 use C4::Context;
 
-my $query = new CGI;
+my $query = CGI->new;
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     {
         template_name   => "opac-recall.tt",
@@ -43,10 +43,10 @@ if ( C4::Context->preference('UseRecalls') ) {
 
     unless ( $biblio->can_be_recalled({ patron => $patron }) ) { $error = 'unavailable'; }
 
-    my $items = Koha::Items->search({ biblionumber => $biblionumber });
+    my $items = Koha::Items->search({ biblionumber => $biblionumber })->as_list;
 
     # check if already recalled
-    my $recalled = scalar $biblio->recalls;
+    my $recalled = $biblio->recalls->filter_by_current->search({ patron_id => $borrowernumber })->count;
     if ( defined $recalled and $recalled > 0 ) {
         my $recalls_per_record = Koha::CirculationRules->get_effective_rule({
             categorycode => $patron->categorycode,