Bug 16886 - 'Upload patron images' tool is not plack safe
Summary: 'Upload patron images' tool is not plack safe
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 7172 17114
  Show dependency treegraph
 
Reported: 2016-07-08 20:16 UTC by Nick Clemens (kidclamp)
Modified: 2017-12-07 22:16 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 16886: Make the 'Upload patron images' tool plack safe (1.87 KB, patch)
2016-07-09 12:18 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 16886: Make the 'Upload patron images' tool plack safe (1.93 KB, patch)
2016-07-11 12:53 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
[PASSED QA] Bug 16886: Make the 'Upload patron images' tool plack safe (2.00 KB, patch)
2016-08-21 19:18 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 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 (kidclamp) 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 (khall) 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