Bug 12656: Allow --reason to be passed to cancel_expired_holds
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 22 Oct 2020 15:26:03 +0000 (16:26 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Nov 2020 11:59:33 +0000 (12:59 +0100)
commit9a113663820634d2d718c8a979e8e70f64b8744a
tree8d9ce657d0a66b08821012a161427183e4f76a24
parentb5dc71be2ee6d49335d9b4ee79edcf68882c555d
Bug 12656: Allow --reason to be passed to cancel_expired_holds

This patch adds the --reason option to cancel_expired_holds which allows
the library to optionally set a reason for cancellation when running the
cronjob. This will prompt the HOLD_CANCELLED notice to be sent to the
patron.

To test:
1/ Ensure the unit tests continue to pass after the patch
   (t/db_dependent/Reserves/CancelExpiredReserves.t)

Also:
1 - Add an expired hold for a patron:
    INSERT INTO RESERVES (borrowernumber, biblionumber, expirationdate, found,branchcode,itemnumber) VALUES (5,5,'2020-01-01','W','CPL',983);
2 - Set ExpireReservesMaxPickUpDelay to Allow
3 - Run the cronjob:
    perl misc/cronjobs/hold/cancel_expired_holds.pl --reason EXPIRED
4 - Visit the patron's notices tab
5 - Confirm they have been sent a cancellation notice

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Reserves.pm
misc/cronjobs/holds/cancel_expired_holds.pl
t/db_dependent/Reserves/CancelExpiredReserves.t