Bug 12134: ensure that patrons are not restricted even when the last restriction has expired

Test Plan:
1) Add a manual restriction to a patron and wait until the
   expiration date of the restriction has passed.  This can be
   simulated by modifying borrowers.debarred for a borrower and
   setting the date in the past.
2) Try to check out an item to that patron
3) Note you cannot
4) Apply this patch
5) Repeat step 2
6) Note you can now check out items the patron

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Kyle Hall 2014-04-24 11:23:05 -04:00 committed by Galen Charlton
parent 2f5e9df121
commit 35a94f6423
2 changed files with 12 additions and 8 deletions

View file

@ -183,7 +183,7 @@ sub IsDebarred {
return unless ($borrowernumber);
my $sql = "SELECT debarred FROM borrowers WHERE borrowernumber = ?";
my $sql = "SELECT debarred FROM borrowers WHERE borrowernumber = ? AND debarred > CURRENT_DATE()";
my $sth = C4::Context->dbh->prepare($sql);
$sth->execute($borrowernumber);
my ($debarred) = $sth->fetchrow_array();

View file

@ -40,7 +40,7 @@ use C4::Reserves;
use C4::Context;
use CGI::Session;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Borrower::Debarments qw(GetDebarments);
use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
use Koha::DateUtils;
use Date::Calc qw(
@ -265,12 +265,16 @@ if ($borrowernumber) {
finetotal => $fines
);
$template->param(
'userdebarred' => $borrower->{debarred},
'debarredcomment' => $borrower->{debarredcomment},
);
if ( $borrower->{debarred} ne "9999-12-31" ) {
$template->param( 'userdebarreddate' => C4::Dates::format_date( $borrower->{debarred} ) );
if ( IsDebarred($borrowernumber) ) {
$template->param(
'userdebarred' => $borrower->{debarred},
'debarredcomment' => $borrower->{debarredcomment},
);
if ( $borrower->{debarred} ne "9999-12-31" ) {
$template->param( 'userdebarreddate' =>
C4::Dates::format_date( $borrower->{debarred} ) );
}
}
}