[PATCH 1/2] [SIGNED-OFF] Bug 8112 - Overdues with Fines giving duplicates

Kyle M Hall kyle at bywatersolutions.com
Thu May 17 16:40:30 CEST 2012


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 <matted-34813 at mypacks.net>
---
 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


------=_Part_6667_14646208.1345762482154
Content-Disposition: attachment; filename="0002-SIGNED-OFF-Bug-8112-Overdues-with-Fines-dup-Followup.patch"
Content-Type: text/x-patch; 
	name=0002-SIGNED-OFF-Bug-8112-Overdues-with-Fines-dup-Followup.patch; 
	charset=us-ascii
Content-Transfer-Encoding: 7bit



More information about the Koha-patches mailing list