Bug 23207: Automatic checkin items should never be overdue

This patch makes Koha::Checkouts->automatic_checkin pass the date_due as
return date to AddReturn.

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts.t
=> FAIL: The feature is not working properly
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomás Cohen Arazi 2021-04-22 09:03:01 -03:00 committed by Jonathan Druart
parent 78f6bb6fa1
commit 137b845f23

View file

@ -82,12 +82,12 @@ sub automatic_checkin {
{ prefetch => 'item'}
);
while(my $checkout = $due_checkouts->next) {
if($checkout->item->itemtype->automatic_checkin) {
C4::Circulation::AddReturn($checkout->item->barcode, $checkout->branchcode);
while ( my $checkout = $due_checkouts->next ) {
if ( $checkout->item->itemtype->automatic_checkin ) {
C4::Circulation::AddReturn( $checkout->item->barcode,
$checkout->branchcode, undef, dt_from_string($checkout->date_due) );
}
}
}
=head3 type