Bug 34924: Add Koha::Checkout->attempt_auto_renew
authorNick Clemens <nick@bywatersolutions.com>
Tue, 26 Sep 2023 13:53:44 +0000 (13:53 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 31 Oct 2023 14:02:46 +0000 (11:02 -0300)
commit95f6015d433892c83edef6d821fcc7c4dfeef9bb
tree491d7dc611b0e3abb433fafd110464e532dae704
parent0f3e68f75f3223fb14dd9cb93a6927dde500e543
Bug 34924: Add Koha::Checkout->attempt_auto_renew

This patch moves the actual renewal out of the auto_renewals cronjob script and into the object and adds tests. The logic for notices is still handled in the script.

To test:
1 - prove -v t/db_dependent/Koha/Checkouts.t
2 - Add a circ rule with auto_renew checked
3 - Checkout an item to a patron and set due date in the past
4 - Checkout an item to a patron and set due date in the future
5 - perl misc/cronjobs/automatic_renewals.pl -v
6 - Confirm one would be renewed and the other is too_soon
7 - perl misc/cronjobs/automatic_renewals.pl -v --confirm
8 - Confirm the expected issue is successfully renewed

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Checkout.pm
misc/cronjobs/automatic_renewals.pl
t/db_dependent/Koha/Checkouts.t