Bug 26132: Remove raw sql query
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 4 Aug 2020 10:05:53 +0000 (12:05 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:15:33 +0000 (10:15 +0200)
commit1af5b8a7d72c8e49f857907c85809a38ee5b1a07
tree6cc6a5a5ac8ff53c8771fecc59ad1e7e8c3c2032
parent3239993fb1f3eafb2eca4004d5bd9a74e9995c1e
Bug 26132: Remove raw sql query

Making use of Koha::Checkouts make the code much more readable here.
It fixes 2 flaws:
 * $type was not quote escaped
 * the effective itemtype was not used which could lead to wrong
 calculation (for instance item-level_itypes is set but the item does
 not have the itype defined)

However there is something to note, we are going to make things a bit
less effective as we are now fetching the items to get their effective
itemtype (vs a SUM done at DB level)

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Circulation.pm
t/db_dependent/Circulation/TooMany.t