Bug 17600: Standardize our EXPORT_OK
[srvgit] / circ / view_holdsqueue.pl
index 2792bd3..81b900b 100755 (executable)
@@ -22,27 +22,21 @@ This script displays items in the tmp_holdsqueue table
 
 =cut
 
-use strict;
-use warnings;
+use Modern::Perl;
 use CGI qw ( -utf8 );
-use C4::Auth;
-use C4::Output;
-use C4::Biblio;
-use C4::Items;
-use C4::HoldsQueue qw(GetHoldsQueueItems);
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use C4::HoldsQueue qw( GetHoldsQueueItems );
 use Koha::BiblioFrameworks;
-
 use Koha::ItemTypes;
 
-my $query = new CGI;
+my $query = CGI->new;
 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
     {
         template_name   => "circ/view_holdsqueue.tt",
         query           => $query,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { circulate => "circulate_remaining_permissions" },
-        debug           => 1,
     }
 );
 
@@ -54,6 +48,9 @@ my $itemtypeslimit = $params->{'itemtypeslimit'};
 if ( $run_report ) {
     # XXX GetHoldsQueueItems() does not support $itemtypeslimit!
     my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit);
+    for my $item ( @$items ) {
+        $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} );
+    }
     $template->param(
         branchlimit     => $branchlimit,
         total      => scalar @$items,
@@ -62,19 +59,6 @@ if ( $run_report ) {
     );
 }
 
-# getting all itemtypes
-my $itemtypes = Koha::ItemTypes->search({}, {order_by => 'itemtype'});;
-my @itemtypesloop;
-while ( my $itemtype = $itemtypes->next ) {
-    push @itemtypesloop, {
-        value       => $itemtype->itemtype,
-    };
-}
-
-$template->param( # FIXME Could be improved passing the $itemtypes iterator directly to the template
-   itemtypeloop => \@itemtypesloop,
-);
-
 # Checking if there is a Fast Cataloging Framework
 $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' );