From e4564349f2411dd33487c83f261999dcd2793846 Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 23 Sep 2005 09:31:15 +0000 Subject: [PATCH] fixing a big bug in circulation rules : the number of issued books was calculated poorly. Seems the bug had not been found before because there most books are of the same itemtype. Of borrowers don't try to issue more than what they can ;-) (thanks to sylvain from doXulting, that pointed the problem & suggested the fix) --- C4/Circulation/Circ2.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Circulation/Circ2.pm b/C4/Circulation/Circ2.pm index ba5b9e6fd7..3dcd048730 100755 --- a/C4/Circulation/Circ2.pm +++ b/C4/Circulation/Circ2.pm @@ -602,7 +602,8 @@ sub TooMany ($$){ $sth->execute($iteminformation->{'biblionumber'}); my $type = $sth->fetchrow; $sth = $dbh->prepare('select * from issuingrules where categorycode = ? and itemtype = ? and branchcode = ?'); - my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?"); +# my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s.biblioitemnumber and s.itemtype like ?"); + my $sth2 = $dbh->prepare("select COUNT(*) from issues i, biblioitems s1, items s2 where i.borrowernumber = ? and i.returndate is null and i.itemnumber = s2.itemnumber and s1.itemtype like ? and s1.biblioitemnumber = s2.biblioitemnumber"); my $sth3 = $dbh->prepare('select COUNT(*) from issues where borrowernumber = ? and returndate is null'); my $alreadyissued; # check the 3 parameters -- 2.39.5