Bug 28959: Fix other cases
[koha-ffzg.git] / reports / catalogue_stats.pl
index be516c1..c3795df 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
-use strict;
-#use warnings; FIXME - Bug 2505
-use C4::Auth;
+use Modern::Perl;
+use C4::Auth qw( get_template_and_user );
 use CGI qw ( -utf8 );
 use C4::Context;
-use C4::Output;
-use C4::Koha;
-use C4::Reports;
-use C4::Circulation;
-use C4::Biblio qw/GetMarcSubfieldStructureFromKohaField/;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Koha qw( GetAuthorisedValues );
+use C4::Reports qw( GetDelimiterChoices );
+use C4::Biblio qw( GetMarcSubfieldStructureFromKohaField );
 
 use Koha::AuthorisedValues;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string );
+use Koha::ItemTypes;
 
 =head1 NAME
 
@@ -41,7 +40,7 @@ plugin that shows a stats on borrowers
 =cut
 
 our $debug = 0;
-my $input = new CGI;
+my $input = CGI->new;
 my $fullreportname = "reports/catalogue_stats.tt";
 my $do_it       = $input->param('do_it');
 my $line        = $input->param("Line");
@@ -70,9 +69,7 @@ my ($template, $borrowernumber, $cookie)
        = get_template_and_user({template_name => $fullreportname,
                                query => $input,
                                type => "intranet",
-                               authnotrequired => 0,
                                flagsrequired => {reports => '*'},
-                               debug => 1,
                                });
 $template->param(do_it => $do_it);
 if ($do_it) {
@@ -114,13 +111,9 @@ if ($do_it) {
     }
 } else {
        my $dbh = C4::Context->dbh;
-       my @values;
-       my %labels;
        my $count=0;
-       my $req;
-       my @select;
 
-    my $itemtypes = GetItemTypes( style => 'array' );
+    my $itemtypes = Koha::ItemTypes->search_with_localization;
 
     my @authvals = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.ccode' }, { order_by => ['description'] } );
     my @locations = map { { code => $_->{authorised_value}, description => $_->{lib} } } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => '', kohafield => 'items.location' }, { order_by => ['description'] } );
@@ -397,7 +390,6 @@ sub calculate {
     }
 
     my $i = 0;
-    my @totalcol;
     my $hilighted = -1;
 
     #Initialization of cell values.....