Bug 17294

Summary: reserves_stats.pl is not plack safe
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: f.demians, julian.maurice, katrin.fischer, kyle, veron
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13914
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, 17253    
Attachments: Bug 17294: Make reserves_stats.pl plack safe
Bug 17294: Make reserves_stats.pl plack safe
Bug 17294: Make reserves_stats.pl plack safe
[PASSED QA] Bug 17294: Make reserves_stats.pl plack safe

Description Jonathan Druart 2016-09-13 08:42:47 UTC
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.
Comment 1 Jonathan Druart 2016-09-13 08:47:07 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2016-09-13 08:49:52 UTC
Created attachment 55518 [details] [review]
Bug 17294: Make reserves_stats.pl plack safe

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.
Comment 3 Marc Véron 2016-09-16 16:52:24 UTC
Created attachment 55626 [details] [review]
Bug 17294: Make reserves_stats.pl plack safe

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 <veron@veron.ch>
Comment 4 Katrin Fischer 2016-09-18 12:44:40 UTC
Hm, something wrong with Plack in my kohadevbox :(
Comment 5 Katrin Fischer 2016-09-25 16:50:17 UTC
Figured out my kohadevbox problem, was able to test this now.
Comment 6 Katrin Fischer 2016-09-25 16:51:18 UTC
Created attachment 55804 [details] [review]
[PASSED QA] Bug 17294: Make reserves_stats.pl plack safe

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 <veron@veron.ch>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 7 Kyle M Hall 2016-09-27 11:08:29 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 8 Frédéric Demians 2016-09-30 08:37:35 UTC
Pushed in 16.05. Will be in 16.05.05.
Comment 9 Julian Maurice 2016-10-14 11:53:24 UTC
Pushed to 3.22.x, will be in 3.22.12