[Koha-patches] [PATCH] [SIGNED-OFF] BZ6328 follow-up 3
conan (aka Fernando L. Canizo)
conan at lugmen.org.ar
Mon May 30 18:04:11 CEST 2011
From: Paul Poulain <paul.poulain at biblibre.com>
Fixes comment 23 from Fernando L. Canizo : when the patron was debarred and debar removed
he still could not check-out.
The changes in the IsMemberBlocked (that were on biblibre/master) were lost somewhere
The sub was still checking for old_issues instead of calling CheckBorrowerDebarred
to get a debardate if applicable
Note : this bug was appearing only is you had issuing rules defined for itemtype/categorycode/branch.
Seemed to work if you had only default rules. That's probably why it hadn't been spotted before
Signed-off-by: conan (aka Fernando L. Canizo) <conan at lugmen.org.ar>
---
C4/Members.pm | 37 +++++--------------------------------
1 files changed, 5 insertions(+), 32 deletions(-)
diff --git a/C4/Members.pm b/C4/Members.pm
index ddbf021..8e57fb1 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -659,39 +659,12 @@ sub IsMemberBlocked {
my $borrowernumber = shift;
my $dbh = C4::Context->dbh;
- # does patron have current fine days?
- my $strsth=qq{
- SELECT
- ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due) ) AS blockingdate,
- DATEDIFF(ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due)),NOW()) AS blockedcount
- FROM old_issues
- };
- if(C4::Context->preference("item-level_itypes")){
- $strsth.=
- qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber)
- LEFT JOIN issuingrules ON (issuingrules.itemtype=items.itype)}
- }else{
- $strsth .=
- qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber)
- LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
- LEFT JOIN issuingrules ON (issuingrules.itemtype=biblioitems.itemtype) };
- }
- $strsth.=
- qq{ WHERE finedays IS NOT NULL
- AND date_due < returndate
- AND borrowernumber = ?
- ORDER BY blockingdate DESC, blockedcount DESC
- LIMIT 1};
- my $sth=$dbh->prepare($strsth);
- $sth->execute($borrowernumber);
- my $row = $sth->fetchrow_hashref;
- my $blockeddate = $row->{'blockeddate'};
- my $blockedcount = $row->{'blockedcount'};
+ my $blockeddate = CheckBorrowerDebarred($borrowernumber);
- return (1, $blockedcount) if $blockedcount > 0;
+ return ( 1, $blockeddate ) if $blockeddate;
# if he have late issues
- $sth = $dbh->prepare(
+ my $sth = $dbh->prepare(
"SELECT COUNT(*) as latedocs
FROM issues
WHERE borrowernumber = ?
@@ -700,9 +673,9 @@ sub IsMemberBlocked {
$sth->execute($borrowernumber);
my $latedocs = $sth->fetchrow_hashref->{'latedocs'};
- return (-1, $latedocs) if $latedocs > 0;
+ return ( -1, $latedocs ) if $latedocs > 0;
- return (0, 0);
+ return ( 0, 0 );
}
=head2 GetMemberIssuesAndFines
--
1.7.2.5
More information about the Koha-patches
mailing list