Bug 16886

Summary: 'Upload patron images' tool is not plack safe
Product: Koha Reporter: Nick Clemens <nick>
Component: ToolsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: f.demians, jonathan.druart, julian.maurice, kyle
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 7172, 17114    
Attachments: Bug 16886: Make the 'Upload patron images' tool plack safe
Bug 16886: Make the 'Upload patron images' tool plack safe
[PASSED QA] Bug 16886: Make the 'Upload patron images' tool plack safe

Description Nick Clemens 2016-07-08 20:16:52 UTC
The patron image tool can correctly process images, however, the variables needed for returning results are global and broken (the script itself documents this issue) and plack errors out when trying to access them.

The results now are limited to 'success' for a 100% successful file and 'failed' when there is an error

logs:
Variable "@counts" is not available at /home/vagrant/kohaclone/tools/picture-upload.pl line 228.
Variable "$filetype" is not available at /home/vagrant/kohaclone/tools/picture-upload.pl line 240.
Variable "$uploadfilename" is not available at /home/vagrant/kohaclone/tools/picture-upload.pl line 241.
Comment 1 Jonathan Druart 2016-07-09 12:18:54 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens 2016-07-11 12:53:35 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2016-08-21 19:18:30 UTC
Created attachment 54664 [details] [review]
[PASSED QA] 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>
Comment 4 Kyle M Hall 2016-09-02 15:22:05 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 5 Frédéric Demians 2016-09-08 19:48:34 UTC
Pushed in 16.05. Will be in 16.05.04.
Comment 6 Julian Maurice 2016-09-16 06:56:13 UTC
Pushed to 3.22.x, will be in 3.22.11