Bug 25683: Fix grouping of results
authorNick Clemens <nick@bywatersolutions.com>
Wed, 10 Jun 2020 12:26:06 +0000 (12:26 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 14 Aug 2020 21:13:01 +0000 (21:13 +0000)
commit41f73194c42d306f3aa9893a01d01938489546bd
treed1423866d8d98e671067cc4a8f607639a638880d
parent6ae42c8c3c7e402db20f424d16950a6162951ac1
Bug 25683: Fix grouping of results

DBIX doesn't seem to work as I expected - if trying to group by we can only
get the columns we grouped by, otherwise the queries are much more complicated
and come out wrong

This patch removes the 'amountoutstanding' from the query. Note that we do return patron
object, however, to access all the columns we must discard_changes (or refetch)

Also fixes a typo 'verbosse'

To test:
1 - charge a $1 fine to a patron
2 - pay off the fine
3 - perl misc/cronjobs/update_patrons_category.pl -f J -t J -fu=5 -v
4 - Note the patron is returned twice
5 - export DBIC_TRACE=1
6 - repeat 3 - view the SQL query and see how odd it is
7 - Apply this patch
8 - repeat 3 - simpler query
9 - patron returned only once

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c7ae33f60c18d2874370e7c2d2f3042fe1331e0e)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/Patrons.pm
misc/cronjobs/update_patrons_category.pl