Bug 20274

Summary: itemtypes.plugin report: not handling item-level_itypes syspref
Product: Koha Reporter: Victor Grousset/tuxayo <victor>
Component: ReportsAssignee: helene <hickeyhe>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, hickeyhe, lucas, martin.renvoize, nick, tomascohen
Version: MainKeywords: Academy
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 20274 When the system preference for item-level_itypes changed, it gave a zero result.
Bug 20274 When the system preference for item-level_itypes changed, it gives a zero result.
Bug 20274: Itemtypes report gives zero results if item-level_itypes set to bibliographic records

Description Victor Grousset/tuxayo 2018-02-22 16:00:03 UTC
== Reproduce ==
1. Use staff:/cgi-bin/koha/reports/manager.pl?report_name=itemtypes
2. Change the syspref item-level_itypes
3. One case should give a 0 result


== Cause ==
There is a conditional but part of the SQL query was copy pasted without being changed.


== Fix ==
"SELECT itemtype" → "SELECT biblioitems.itemtype" in these two lines

https://gitlab.com/koha-community/Koha/blob/673a40d2acc5c8c58b7f3e7e6d11c329d0587fc6/reports/itemtypes.plugin#L46

https://gitlab.com/koha-community/Koha/blob/673a40d2acc5c8c58b7f3e7e6d11c329d0587fc6/reports/itemtypes.plugin#L68

(or maybe the other ones)
Comment 1 helene 2019-01-15 23:14:59 UTC
Created attachment 84032 [details] [review]
Bug 20274 When the system preference for item-level_itypes changed, it gave a zero result.

1) Go to reports then catalog by item types
2) Pick a location and look at table
3) Change the system prefernce of item-level_itypes
4) Verify a zero result
5) Apply patch and retry
6) Verify that result does not change to zero on either preference
Comment 2 David Nind 2019-01-17 12:07:40 UTC
Created attachment 84138 [details] [review]
Bug 20274 When the system preference for item-level_itypes changed, it gives a zero result.

1) Go to reports then catalog by item types
2) Pick a location and look at table
3) Change the system prefernce of item-level_itypes
4) Verify a zero result
5) Apply patch and retry
6) Verify that result does not change to zero on either preference

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Tomás Cohen Arazi 2019-01-17 15:50:33 UTC
Created attachment 84144 [details] [review]
Bug 20274: Itemtypes report gives zero results if item-level_itypes set to bibliographic records

1) Go to reports then catalog by item types
2) Pick a location and look at table
3) Change the system prefernce of item-level_itypes
4) Verify a zero result
5) Apply patch and retry
6) Verify that result does not change to zero on either preference

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2019-01-17 15:59:18 UTC
Good fix!

For next patch: please make sure the commit subject (the first line) follows the guidelines. You can run the qa script yourself before submitting so you can fix that!
Comment 5 Nick Clemens (kidclamp) 2019-01-18 20:57:14 UTC
Awesome work all!

Pushed to master for 19.05
Comment 6 Martin Renvoize 2019-01-31 16:22:44 UTC
Pushed to 18.11.x for 18.11.03
Comment 7 Lucas Gass 2019-02-01 19:23:57 UTC
pushed to 18.05.x for 18.05.09
Comment 8 Fridolin Somers 2019-02-04 09:49:59 UTC
Ok for this patch.

But I think this file needs more work.
I see : while (($itemtype, $description,$biblioitems,$total) = $sth->fetchrow)
So first var is the item type. $biblioitems seems unused.
This code is confusing.
Comment 9 Fridolin Somers 2019-02-04 09:51:52 UTC
Pushed to 17.11.x for 17.11.15