Bug 9451: Quiet warnings and Plackify borrower_stats.pl
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Tue, 22 Jan 2013 23:40:25 +0000 (18:40 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Fri, 8 Feb 2013 13:42:32 +0000 (08:42 -0500)
There are several warnings and one non-Plack-compatible variable in
reports/borrower_stats.pl.

To test:
1) Apply patch
2) Use the borrower report wizard to create a report that includes an
   extended patron attribute.
3) Check the logs, and make sure that you don't see any of the
   following messages:
   Variable "$period" is not available at
     /home/jcamins/kohaclone/reports/borrowers_stats.pl line 265.
   Use of uninitialized value in hash element at
     /home/jcamins/kohaclone/reports/borrowers_stats.pl line 375.
   Use of uninitialized value in hash element at
     /home/jcamins/kohaclone/reports/borrowers_stats.pl line 376.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>

reports/borrowers_stats.pl

index 9454fc5..8181285 100755 (executable)
@@ -56,7 +56,7 @@ my @filters = $input->param("Filter");
 $filters[3]=format_date_in_iso($filters[3]);
 $filters[4]=format_date_in_iso($filters[4]);
 my $digits = $input->param("digits");
-my $period = $input->param("period");
+our $period = $input->param("period");
 my $borstat = $input->param("status");
 my $borstat1 = $input->param("activity");
 my $output = $input->param("output");
@@ -372,6 +372,7 @@ sub calculate {
             my $coltitle = $row->{coltitle} // '';
             $table{$rowtitle}->{$coltitle} = 0;
                }
+        $row->{rowtitle} ||= '';
                $table{$row->{rowtitle}}->{totalrow}=0;
                $table{$row->{rowtitle}}->{rowtitle_display} = $row->{rowtitle_display};
        }