Bug 31378: Add dependencies
[koha-ffzg.git] / Koha / Checkouts.pm
index a7b5060..76a3b9e 100644 (file)
@@ -19,13 +19,12 @@ package Koha::Checkouts;
 
 use Modern::Perl;
 
-use Carp;
 
 use C4::Context;
-use C4::Circulation;
+use C4::Circulation qw( AddReturn );
 use Koha::Checkout;
 use Koha::Database;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string );
 
 use base qw(Koha::Objects);
 
@@ -82,12 +81,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