[Koha-patches] [PATCH 2/2] bugfix CircRestrictPreviouslyIssued - bad SQL

Michael Hafen mdhafen at tech.washk12.org
Fri Feb 19 18:55:33 CET 2010


The SQL for this feature didn't restrict the book check to the patron.
So any book that had been checked out by anyone before would trigger the
warning.
That's fixed.
---
 C4/Circulation.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 98905b5..26675e0 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -834,8 +834,8 @@ sub CanBookBeIssued {
     # Check if borrower has checked this title out before
     #
     if ( C4::Context->preference("CircRestrictPreviouslyIssued") ) {
-        my $sth = $dbh->prepare("SELECT old_issues.itemnumber FROM old_issues CROSS JOIN items USING (itemnumber) WHERE biblionumber = ?");
-        $sth->execute($item->{'biblionumber'});
+        my $sth = $dbh->prepare("SELECT old_issues.itemnumber FROM old_issues CROSS JOIN items USING (itemnumber) WHERE biblionumber = ? AND borrowernumber = ?");
+        $sth->execute($item->{'biblionumber'},$borrower->{'borrowernumber'});
         my $alreadyissued = $sth->fetchrow_hashref();
         $sth->finish();
         if ( $alreadyissued->{'itemnumber'} ) {
-- 
1.6.3.3




More information about the Koha-patches mailing list