From 0af0e6dc5f18c262c02cbd4914786c74f3cbe93d Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 14 May 2020 13:21:22 +0000 Subject: [PATCH] Bug 18532: (follow-up) UNTESTED add individual issues to digest notice This is how I think this works, I did not test this code --- installer/data/mysql/atomicupdate/bug-18532.perl | 15 +++++++++++---- misc/cronjobs/automatic_renewals.pl | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug-18532.perl b/installer/data/mysql/atomicupdate/bug-18532.perl index 4bb601dd6e..5775863372 100644 --- a/installer/data/mysql/atomicupdate/bug-18532.perl +++ b/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'); }); diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index 2a978dcfed..e22751a980 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/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, }, -- 2.20.1