Bug 25531: Debar patron if needed when checkin is backdated
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 18 May 2020 15:50:11 +0000 (17:50 +0200)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Thu, 11 Jun 2020 16:06:40 +0000 (18:06 +0200)
If think this case does not apply to real-life, but the logic needs to
be fixed.
If an item is due now, and AddReturn is called now with a return date in
the future, the issue is overdue and the patron must be debarred.
However it is not as we compare with now and not the return date

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>

(cherry picked from commit 0c238db2f5763db48fe3d451b599ffd6b0e42869)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

C4/Circulation.pm

index 727fbf8..c91d056 100644 (file)
@@ -2036,7 +2036,7 @@ sub AddReturn {
         my $fix = _FixOverduesOnReturn( $borrowernumber, $item->itemnumber, $exemptfine );
         defined($fix) or warn "_FixOverduesOnReturn($borrowernumber, $item->itemnumber...) failed!";  # zero is OK, check defined
 
-        if ( $issue and $issue->is_overdue ) {
+        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){