Bug 16760 - Circulation Statistics wizard not populating itemtype correctly
Summary: Circulation Statistics wizard not populating itemtype correctly
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Galen Charlton
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 7172
  Show dependency treegraph
 
Reported: 2016-06-16 22:33 UTC by Nick Clemens
Modified: 2018-12-03 20:03 UTC (History)
6 users (show)

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


Attachments
Bug 16760: fix Circulation Statistics wizard under Plack (3.23 KB, patch)
2016-07-05 16:29 UTC, Galen Charlton
Details | Diff | Splinter Review
Bug 16760: fix Circulation Statistics wizard under Plack (3.29 KB, patch)
2016-07-05 19:54 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 16760: fix Circulation Statistics wizard under Plack (3.36 KB, patch)
2016-07-06 14:04 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2016-06-16 22:33:34 UTC
To recreate:
1 - Run the statistics wizard for a range
2 - set date as columns
3 - set itemtype as rows
4 - Row headers all come out as "UNKNOWN VALUE"

Screenshot
https://snag.gy/iZQRvY.jpg
Comment 1 Galen Charlton 2016-07-05 16:10:12 UTC
I was able to reproduce this when running under Plack. Turning on warnings in issues_stats2.pl shows the problem:

Variable "@filters" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 223.
Variable "$itemtypes" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 309.
Variable "$ccodes" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 313.
Variable "$locations" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 314.
Variable "$Bsort1" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 318.
Variable "$Bsort2" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 323.
Variable "$categoryloop" is not available at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 328.
...

In particular, because $itemtypes is not carried over into the calculate subroutine, no display labels are found.
Comment 2 Galen Charlton 2016-07-05 16:29:27 UTC Comment hidden (obsolete)
Comment 3 Nick Clemens 2016-07-05 19:54:52 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2016-07-06 14:04:28 UTC
Created attachment 53128 [details] [review]
Bug 16760: fix Circulation Statistics wizard under Plack

This patch fixes some variable scoping problems when running
the circulation statistics wizard under Plack.  For example,
when using the item type as a row header, with this patch the
item type description is displayed rather than "UKNOWN VALUE".

This patch also enables warnings and fixes a couple variable
initialization issues. (Note that turning on warnings across
the board would make it easier to identify Plack variable scoping
issues, as "Variable "$foo" is not available at' errors would
be recorded in the Plack error log).

To test
-------
[1] Run the staff interface under Plack.
[2] Go to the Circulation Statistics Wizard and run a report
    using item type as the row. Note that the row labels
    display as "UNKNOWN VALUE" rather than the item type.
[3] Apply the patch and restart Plack.
[4] Run step #2 again; this time, the item type descriptions should
    be used as the row labels.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 5 Kyle M Hall 2016-07-08 12:49:23 UTC
Pushed to master for 16.11, thanks Galen!
Comment 6 Galen Charlton 2016-07-12 17:37:18 UTC
Thanks Kyle. RMaints, I'd also like to request backporting to 16.05.x and 3.22.x.
Comment 7 Frédéric Demians 2016-08-01 13:22:40 UTC
Pushed in 16.05. Will be in 16.05.02.
Comment 8 Julian Maurice 2016-08-16 14:19:37 UTC
Patch pushed to 3.22.x, will be in 3.22.10
Comment 9 MetaBiblioteca Colombia 2017-07-31 19:49:28 UTC
Hello, In Koha 17.X (0,1,2) This error still persists
Comment 10 Jonathan Druart 2017-07-31 19:59:19 UTC
(In reply to MetaBiblioteca Colombia from comment #9)
> Hello, In Koha 17.X (0,1,2) This error still persists

Please open a new bug report and describe the problem.
Comment 11 Jonathan Druart 2017-12-20 16:02:52 UTC
(In reply to Jonathan Druart from comment #10)
> (In reply to MetaBiblioteca Colombia from comment #9)
> > Hello, In Koha 17.X (0,1,2) This error still persists
> 
> Please open a new bug report and describe the problem.

See bug 19671