From 70ca305311cfdc7c56da5ce6cae8706d2bcacf80 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 13 Sep 2016 09:44:41 +0100 Subject: [PATCH] Bug 17294: Make reserves_stats.pl plack safe MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Lot of errors are raised by this script under plack because of var scope issues: Variable "$ccodes" is not available at /home/koha/src/reports/reserves_stats.pl line 337. Variable "$locations" is not available at /home/koha/src/reports/reserves_stats.pl line 338. Variable "$itemtypes" is not available at /home/koha/src/reports/reserves_stats.pl line 339. Variable "$Bsort1" is not available at /home/koha/src/reports/reserves_stats.pl line 344. Variable "$Bsort2" is not available at /home/koha/src/reports/reserves_stats.pl line 350. Variable "@patron_categories" is not available at /home/koha/src/reports/reserves_stats.pl line 356. The lazy way to fix that is that reinit them from the subroutines they are used. Test plan: Execute the report, after this patch applied you won't see the error in the log. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall (cherry picked from commit f66cc4dfcca243e6210c3323586efbfbd6cfe0cd) Signed-off-by: Frédéric Demians (cherry picked from commit 1ade46e5a4928ffd8ae4080b0f0f09c0b564ed13) Signed-off-by: Julian Maurice --- reports/reserves_stats.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reports/reserves_stats.pl b/reports/reserves_stats.pl index 792a7721e2..9ffa2121cc 100755 --- a/reports/reserves_stats.pl +++ b/reports/reserves_stats.pl @@ -334,6 +334,12 @@ sub null_to_zzempty ($) { } sub display_value { my ( $crit, $value ) = @_; + my $ccodes = GetKohaAuthorisedValues("items.ccode"); + my $locations = GetKohaAuthorisedValues("items.location"); + my $itemtypes = GetItemTypes(); + my $authvalue = GetKohaAuthorisedValues("items.authvalue"); + my $Bsort1 = GetAuthorisedValues("Bsort1"); + my $Bsort2 = GetAuthorisedValues("Bsort2"); my $display_value = ( $crit =~ /ccode/ ) ? $ccodes->{$value} : ( $crit =~ /location/ ) ? $locations->{$value} -- 2.39.5