From 4754738d86011b74e3de99d93f92f98296ba39c8 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 22 Nov 2021 13:27:34 +0000 Subject: [PATCH] Bug 29555: Don't push auto_too_soon issues into report This patch adds a conditional to avoid reporting on issues that are too soon to be renewed To test: 1 - Set AutoRenewalNotices preference to 'according to patron messaging preferences' 2 - Set a patront o request auto renewal emails digested 3 - Checkout an item to the patron, back dated to be opverdue, and marked for auto renewal 4 - Add an email to the patron for testing 5 - perl misc/cronjobs/automatic_renewals.pl -v -c 6 - See the issue is renewed (ensure it is now not overdue) 7 - Confirm the patron was sent a digest with the renewal (on patron 'Notices' tab) 8 - perl misc/cronjobs/automatic_renewals.pl -v -c 9 - See the issue was not renewed 10 - See a notice was sent, with no indication of what happened to the issue 11 - Apply patch 12 - perl misc/cronjobs/automatic_renewals.pl -v -c 13 - Confrim no renewal or notice 14 - Checkout a second item to patron, backdated and set for auto renewal 15 - perl misc/cronjobs/automatic_renewals.pl -v -c 16 - Confirm the correct item is renewed and notice sent 17 - Confirm notice does not include the too soon issue 18 - Checkout a third item 19 - perl misc/cronjobs/automatic_renewals.pl -v -c -b 20 - Confirm correct item is renewed and notice sent, nbot including other two 21 - perl misc/cronjobs/automatic_renewals.pl -v -c -b 22 - Confirm no notice sent --- misc/cronjobs/automatic_renewals.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index b21f9a42e2..cf357ad214 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -184,11 +184,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 eq 'auto_too_soon' ; - push @{$renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{issues}}, $auto_renew->itemnumber; + push @{$renew_digest->{ $auto_renew->branchcode }->{ $auto_renew->borrowernumber }->{issues}}, $auto_renew->itemnumber unless $error eq 'auto_too_soon'; } 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->itemnumber; + push @{$renew_digest->{ $auto_renew->borrowernumber }->{issues}}, $auto_renew->itemnumber unless $error eq 'auto_too_soon'; } } -- 2.20.1