This patch deals with fixing the overdues with fines report only.

Handling of reconciling those dups must be addressed somewhere else.

I only tested the behavior of the report with the above two patches.

Test:
1) configured a patron with overdue items with fines.
2) i ran the overdue with fines report
i saw two rows, one for each patron ( normal scenario)
3) to emulate a dupe FU fine update in accountlines, I insert the row
refer to attachment above ... 
circulation_overdues_report_createdupefine_same_item.png
for mysql work
4) i ran the overdue with fines report
I saw three rows, but two for the same patron and same item (multiple FU case)
refer to attachment above ... circulation_overdues_report_dupefine.png
5) applied 0001 and 0002 patches, and ran report gain
I saw only two rows, even tough dups exist in the database.
refer to  circulation_overdues_report_dupefine1_nodupeshowing.png

This reports behaviour will work wether dups exist or not.  But when in place,
it hides the dups.

Note: Folks on IRC mentioned this was the result of an upgrade from 3.6.x to 
3.8.x
In leiu of performing an upgrade, I took this route.

wajasu
>From f7d8dd7698f2860c77de67a025901af80f4002cc Mon Sep 17 00:00:00 2001
From: Kyle M Hall <[email protected]>
Date: Thu, 17 May 2012 10:40:30 -0400
Subject: [PATCH 1/2] [SIGNED-OFF] Bug 8112 - Overdues with Fines giving
 duplicates

If a borrower has multiple fines of type FU for a given item,
that row will appear in the Overdues with Fines report
for each fine on record.

Fixed by grouping the results by borrowernumber.

Signed-off-by: wajasu <[email protected]>
---
 C4/Overdues.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/C4/Overdues.pm b/C4/Overdues.pm
index d17f445..e2a8abf 100644
--- a/C4/Overdues.pm
+++ b/C4/Overdues.pm
@@ -1261,10 +1261,10 @@ sub GetOverduesForBranch {
     my $i = 0;
     my $sth;
     if ($location) {
-        $sth = $dbh->prepare("$select AND items.location = ? ORDER BY borrowers.surname, borrowers.firstname");
+        $sth = $dbh->prepare("$select AND items.location = ? GROUP BY borrowers.borrowernumber ORDER BY borrowers.surname, borrowers.firstname");
         $sth->execute($branch, $location);
     } else {
-        $sth = $dbh->prepare("$select ORDER BY borrowers.surname, borrowers.firstname");
+        $sth = $dbh->prepare("$select GROUP BY borrowers.borrowernumber ORDER BY borrowers.surname, borrowers.firstname");
         $sth->execute($branch);
     }
     while ( my $data = $sth->fetchrow_hashref ) {
-- 
1.7.11.4

>From 77c233aaf0873713e00c78abc5765a9137d100c2 Mon Sep 17 00:00:00 2001
From: Kyle M Hall <[email protected]>
Date: Mon, 13 Aug 2012 10:46:25 -0400
Subject: [PATCH 2/2] [SIGNED-OFF] Bug 8112 - Overdues with Fines dup Followup
 - Add items.itemnumber to GROUP BY

This follow just added the items.itemnumber to GROUP BY

Signed-off-by: wajasu <[email protected]>
---
 C4/Overdues.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/C4/Overdues.pm b/C4/Overdues.pm
index e2a8abf..d44f8b9 100644
--- a/C4/Overdues.pm
+++ b/C4/Overdues.pm
@@ -1264,7 +1264,7 @@ sub GetOverduesForBranch {
         $sth = $dbh->prepare("$select AND items.location = ? GROUP BY borrowers.borrowernumber ORDER BY borrowers.surname, borrowers.firstname");
         $sth->execute($branch, $location);
     } else {
-        $sth = $dbh->prepare("$select GROUP BY borrowers.borrowernumber ORDER BY borrowers.surname, borrowers.firstname");
+        $sth = $dbh->prepare("$select GROUP BY borrowers.borrowernumber, items.itemnumber ORDER BY borrowers.surname, borrowers.firstname");
         $sth->execute($branch);
     }
     while ( my $data = $sth->fetchrow_hashref ) {
-- 
1.7.11.4

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to