@@ -, +, @@ checkout is due in the future - Check an item in and mark it as auto renewal, use a due date in the - Place a hold in this item - Execute the cronjob --- misc/cronjobs/automatic_renewals.pl | 6 ++++++ 1 file changed, 6 insertions(+) --- a/misc/cronjobs/automatic_renewals.pl +++ a/misc/cronjobs/automatic_renewals.pl @@ -56,6 +56,7 @@ use C4::Circulation; use C4::Context; use C4::Log; use C4::Letters; +use Koha::DateUtils qw( dt_from_string ); use Koha::Checkouts; use Koha::Libraries; use Koha::Patrons; @@ -71,6 +72,7 @@ pod2usage(0) if $help; cronlogaction(); my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 }); +my $today = dt_from_string; my %report; while ( my $auto_renew = $auto_renews->next ) { @@ -89,6 +91,10 @@ while ( my $auto_renew = $auto_renews->next ) { or $error eq 'auto_too_much_oweing' or $error eq 'auto_too_soon' ) { if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) { + next # Do not notify 'on_reserve' if the due date is later than today + if $error eq 'on_reserve' + and $today->truncate( to => 'day' ) < dt_from_string( $auto_renew->date_due, 'sql' )->truncate( to => 'day' ); + $auto_renew->auto_renew_error($error)->store; push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew if $error ne 'auto_too_soon'; # Do not notify if it's too soon --