Bug 30755: (follow-up) Add a results hash to automatic renewals
authorNick Clemens <nick@bywatersolutions.com>
Fri, 2 Sep 2022 07:52:15 +0000 (07:52 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 19 Sep 2022 18:11:06 +0000 (15:11 -0300)
commit95ebfa1f2946046d12dbfc1a13e8171b890f0249
tree8fea9563eae1c02f659700746fa7f68b2c1dc6d7
parentc41fab2292da13f4bf7cac0110216c4f8e4721d7
Bug 30755: (follow-up) Add a results hash to automatic renewals

It's slightly debatable whether auto_too_soon is an error or not. I think
it leans far enough towards error that the other patch is correct. The change, however,
will affect notices and means we cannot count auto_too_soon anymore

This patch adds a new 'results' hash to the info - this includes a count per error
(including auto_renew i.e. success) allowing for notices to decide how to display the info.

To test:
1 - Add to Auto renew digest notice:
[% IF results %]
There were [% results.auto_too_soon %] items that were too soon.
[% END %]
2 - Check out some items to a patron that will be too soon
3 - Check out one that is not too soon and will renew
4 - Ensure patron has auto renew digest selected and that AutoRenewalNotices is set to follow patron preferences
5 - Run the auto renewals cron
6 - Confirm the notice for the patron displays 1 successful renewal, no failures, and a correct count of too_soon

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
misc/cronjobs/automatic_renewals.pl