Bug 14784: Fix checkin message for restricted patrons

Test plan:
Before

1) Select a user with active indefinite or definite restrictions (manual restriction works)
2) Make sure finedays=0 for the user category. See [1]
3) Checkout and return an item (not overdue)
   A previous restriction reminder will appear
4) Checkout and return an overdue item (change the date at checkout)
   No previous restriction reminder will appear

After applying patch:
Same steps, but a reminder should appear for step 4)

[1] The "finedays" setting is called "Suspension in days" in the web interface, if you're searching for it like I did...

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a05bb1e36d)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Shi Yao Wang 2022-06-13 14:05:53 -04:00 committed by Matt Blenkinsop
parent af6d8d73af
commit 54976b2ea5
1 changed files with 17 additions and 4 deletions

View File

@ -2306,10 +2306,23 @@ sub AddReturn {
if ( $issue and $issue->is_overdue($return_date) ) {
# fix fine days
my ($debardate,$reminder) = _debar_user_on_return( $patron_unblessed, $item->unblessed, dt_from_string($issue->date_due), $return_date );
if ($reminder){
$messages->{'PrevDebarred'} = $debardate;
} else {
$messages->{'Debarred'} = $debardate if $debardate;
if ($debardate and $debardate ne "9999-12-31") {
if ($reminder){
$messages->{'PrevDebarred'} = $debardate;
} else {
$messages->{'Debarred'} = $debardate;
}
} elsif ($patron->debarred) {
if ( $patron->debarred eq "9999-12-31") {
$messages->{'ForeverDebarred'} = $patron->debarred;
} else {
my $borrower_debar_dt = dt_from_string( $patron->debarred );
$borrower_debar_dt->truncate(to => 'day');
my $today_dt = $return_date->clone()->truncate(to => 'day');
if ( DateTime->compare( $borrower_debar_dt, $today_dt ) != -1 ) {
$messages->{'PrevDebarred'} = $patron->debarred;
}
}
}
# there's no overdue on the item but borrower had been previously debarred
} elsif ( $issue->date_due and $patron->debarred ) {