@@ -, +, @@ soonest renewal date 1 - Checkout an item to a patron with a due date 2 days in the future and 'No renewal before' unset 2 - Place a hold on that item 3 - Define an AUTO_RENEWALS circulation notice with below at a minimum [% checkout.auto_renew_error %] 4 - perl misc/cronjobs/automatic_renewals.pl --send-notices 5 - Patron is not notified 6 - Set 'No renewal before' to 1 7 - run cronjob 8 - Patron is notified with error 'on_reserve' 9 - Set 'No renewal before' to 3 --- misc/cronjobs/automatic_renewals.pl | 6 ++++++ 1 file changed, 6 insertions(+) --- a/misc/cronjobs/automatic_renewals.pl +++ a/misc/cronjobs/automatic_renewals.pl @@ -75,6 +75,12 @@ my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 }); my %report; while ( my $auto_renew = $auto_renews->next ) { +#If norenewalbefore is undef, $NoRenewalBeforeThisDate will equal $now. + my $NoRenewalBeforeThisDate = C4::Circulation::GetSoonestRenewDate($auto_renew->borrowernumber, $auto_renew->itemnumber); + my $now = Koha::DateUtils::dt_from_string; + if ( $NoRenewalBeforeThisDate > $now ){ + next; + } # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber ); if ( $error eq 'auto_renew' ) { --