|
Lines 56-61
use C4::Circulation;
Link Here
|
| 56 |
use C4::Context; |
56 |
use C4::Context; |
| 57 |
use C4::Log; |
57 |
use C4::Log; |
| 58 |
use C4::Letters; |
58 |
use C4::Letters; |
|
|
59 |
use Koha::DateUtils qw( dt_from_string ); |
| 59 |
use Koha::Checkouts; |
60 |
use Koha::Checkouts; |
| 60 |
use Koha::Libraries; |
61 |
use Koha::Libraries; |
| 61 |
use Koha::Patrons; |
62 |
use Koha::Patrons; |
|
Lines 71-76
pod2usage(0) if $help;
Link Here
|
| 71 |
cronlogaction(); |
72 |
cronlogaction(); |
| 72 |
|
73 |
|
| 73 |
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 }); |
74 |
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 }); |
|
|
75 |
my $today = dt_from_string; |
| 74 |
|
76 |
|
| 75 |
my %report; |
77 |
my %report; |
| 76 |
while ( my $auto_renew = $auto_renews->next ) { |
78 |
while ( my $auto_renew = $auto_renews->next ) { |
|
Lines 89-94
while ( my $auto_renew = $auto_renews->next ) {
Link Here
|
| 89 |
or $error eq 'auto_too_much_oweing' |
91 |
or $error eq 'auto_too_much_oweing' |
| 90 |
or $error eq 'auto_too_soon' ) { |
92 |
or $error eq 'auto_too_soon' ) { |
| 91 |
if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) { |
93 |
if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) { |
|
|
94 |
next # Do not notify 'on_reserve' if the due date is later than today |
| 95 |
if $error eq 'on_reserve' |
| 96 |
and $today->truncate( to => 'day' ) < dt_from_string( $auto_renew->date_due, 'sql' )->truncate( to => 'day' ); |
| 97 |
|
| 92 |
$auto_renew->auto_renew_error($error)->store; |
98 |
$auto_renew->auto_renew_error($error)->store; |
| 93 |
push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew |
99 |
push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew |
| 94 |
if $error ne 'auto_too_soon'; # Do not notify if it's too soon |
100 |
if $error ne 'auto_too_soon'; # Do not notify if it's too soon |
| 95 |
- |
|
|