@@ -, +, @@ digest notice --- installer/data/mysql/atomicupdate/bug-18532.perl | 15 +++++++++++---- misc/cronjobs/automatic_renewals.pl | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) --- a/installer/data/mysql/atomicupdate/bug-18532.perl +++ a/installer/data/mysql/atomicupdate/bug-18532.perl @@ -4,11 +4,18 @@ if( CheckVersion( $DBversion ) ) { $dbh->do( qq{ INSERT IGNORE INTO letter (module, code, name, title, content, message_transport_type) VALUES ('circulation', 'AUTO_RENEWALS_DGST', 'notification on auto renewing', 'Auto renewals (Digest)', "Dear [% borrower.firstname %] [% borrower.surname %], - [% IF checkout.auto_renew_errors %] - There were [% checkout.auto_renew_errors %] items that where not correctly renewed. + [% IF error %] + There were [% error %] items that were not correctly renewed. [% END %] - [% IF checkout.auto_renew %] - There were [% checkout.auto_renew %] items that where correctly renewed. + [% IF success %] + There were [% success %] items that where correctly renewed. + [% END %] + [% FOREACH issue IN issues %] + [% issue.item.biblio.title %] : [% issue.item.barcode %] + [% IF issue.auto_renew_error IS NULL %] + was renewed until [% issue.date_due %] + [% ELSE %] + was not renewed with error: [% issue.auto_renew_error %] [% END %] ", 'email'); }); --- a/misc/cronjobs/automatic_renewals.pl +++ a/misc/cronjobs/automatic_renewals.pl @@ -181,9 +181,11 @@ while ( my $auto_renew = $auto_renews->next ) { if ($digest_per_branch) { $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{success}++ if $error eq 'auto_renew'; $renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error == 'auto_too_soon' ; + push @{$renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{issues}} $auto_renew->issue_id; } else { $renew_digest->{ $auto_renew->borrowernumber }->{success} ++ if $error eq 'auto_renew'; $renew_digest->{ $auto_renew->borrowernumber }->{error}++ unless $error eq 'auto_renew' || $error eq 'auto_too_soon' ; + push @{$renew_digest->{ $auto_renew->borrowernumber }->{issues}} $auto_renew->issue_id; } } @@ -292,6 +294,7 @@ sub send_digests { error => $digest->{error}||0, success => $digest->{success}||0, }, + loops => { issues => \@{$digest->{issues} }, tables => { borrowers => $patron->borrowernumber, }, --