Bug 29346: Hold actions triggers
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 16 Mar 2022 20:22:28 +0000 (17:22 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 5 May 2022 21:17:35 +0000 (11:17 -1000)
commitb09d93b4e9bf2a3f44080c25d34431f4ca2ed8bf
tree85cbc1b07d8b36ac4ef43a7ea444230dd5265f87
parent830dfab5487e97dec94fdb6591245d31e54a15ee
Bug 29346: Hold actions triggers

This patch makes several holds related actions schedule the background
job for real-time update of the holds queue.

This actions are:

- place (C4::Reserves::AddReserve)
- fill (Koha::Hold->fill)
- cancel (Koha::Hold->cancel)
- suspend (Koha::Hold->suspend)
- resume (Koha::Hold->resume)

The cancel() action is added a *skip_holds_queue* parameter to skip
triggering the background job entirely. It targets cases like
C4::Biblio::DelBiblio in which all biblio holds are cancelled in a loop.
In that case, we just want to cancel them and let a single backgroung
job take care of the holds queue, once the biblio is deleted.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t \
           t/db_dependent/Reserves.t
=> SUCCESS: Tests pass! Triggers are triggered
3. Sign off :-D

Sponsored-by: Montgomery County Public Libraries
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Reserves.pm
Koha/Hold.pm
t/db_dependent/Koha/Hold.t
t/db_dependent/Reserves.t