Bug 16886: Make the 'Upload patron images' tool plack safe

Some vars are accessed from subroutine, but defined with my.
It causes at least the 2 followings errors:
Variable "$filetype" is not available at
/home/koha/src/tools/picture-upload.pl line 240.
Variable "$uploadfilename" is not available at
/home/koha/src/tools/picture-upload.pl line 241.

To avoid that, they are now declared with our.

Test plan:
Upload image for a patron and confirm that you get a "Result" table and
the errors do not longer appear in the logs.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 762415a2ff)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Jonathan Druart 2016-07-09 13:13:35 +01:00 committed by Frédéric Demians
parent a1fdbf92da
commit 4cf4751c08
1 changed files with 5 additions and 3 deletions

View File

@ -46,9 +46,9 @@ my ($template, $loggedinuser, $cookie)
debug => 0,
});
my $filetype = $input->param('filetype');
our $filetype = $input->param('filetype') || '';
my $cardnumber = $input->param('cardnumber');
my $uploadfilename = $input->param('uploadfile');
our $uploadfilename = $input->param('uploadfile') || '';
my $uploadfile = $input->upload('uploadfile');
my $borrowernumber = $input->param('borrowernumber');
my $op = $input->param('op') || '';
@ -76,7 +76,9 @@ Files greater than 100K will be refused. Images should be 140x200 pixels. If the
$debug and warn "Operation requested: $op";
my ( $total, $handled, @counts, $tempfile, $tfh, %errors );
my ( $total, $handled, $tempfile, $tfh );
our @counts = ();
our %errors = ();
# Case is important in these operational values as the template must use case to be visually pleasing!
if ( ( $op eq 'Upload' ) && $uploadfile ) {