Bug 34365

Summary: Hold cancellation request workflow cannot be triggered on API
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: emily.lamancusa, fabriciomolina, fridolin.somers, jzairo, myranda, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34333
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.03,22.11.09
Circulation function:
Attachments: Bug 34365: Unit tests
Bug 34365: Add cancellation request flow to DELETE /holds
Bug 34365: Unit tests
Bug 34365: Add cancellation request flow to DELETE /holds
Bug 34365: Unit tests
Bug 34365: Add cancellation request flow to DELETE /holds

Description Tomás Cohen Arazi (tcohen) 2023-07-24 18:02:19 UTC
Rigth now the `DELETE /holds/:holds` route does a straight-cancellation of the hold. It should be possible to trigger the hold cancellation request workflow so thrid-party systems can use it.
Comment 1 Tomás Cohen Arazi (tcohen) 2023-07-24 19:58:56 UTC
Created attachment 153855 [details] [review]
Bug 34365: Unit tests
Comment 2 Tomás Cohen Arazi (tcohen) 2023-07-24 19:58:58 UTC
Created attachment 153856 [details] [review]
Bug 34365: Add cancellation request flow to DELETE /holds

This patch adds a new `x-koha-override` header to allow enforcing the
cancellation request flow for waiting holds.

If the hold is not waiting, the header has no effect.

To test:
1. Apply the tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: The endpoint doesn't implement the required logic
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint behavior is changed!
5. Sign off :-D
Comment 3 Emily Lamancusa (emlam) 2023-07-26 18:40:19 UTC
Created attachment 153935 [details] [review]
Bug 34365: Unit tests

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 4 Emily Lamancusa (emlam) 2023-07-26 18:40:21 UTC
Created attachment 153936 [details] [review]
Bug 34365: Add cancellation request flow to DELETE /holds

This patch adds a new `x-koha-override` header to allow enforcing the
cancellation request flow for waiting holds.

If the hold is not waiting, the header has no effect.

To test:
1. Apply the tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: The endpoint doesn't implement the required logic
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint behavior is changed!
5. Sign off :-D

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 5 Kyle M Hall (khall) 2023-08-02 11:22:23 UTC
Created attachment 154154 [details] [review]
Bug 34365: Unit tests

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Kyle M Hall (khall) 2023-08-02 11:22:30 UTC
Created attachment 154155 [details] [review]
Bug 34365: Add cancellation request flow to DELETE /holds

This patch adds a new `x-koha-override` header to allow enforcing the
cancellation request flow for waiting holds.

If the hold is not waiting, the header has no effect.

To test:
1. Apply the tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: The endpoint doesn't implement the required logic
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! The endpoint behavior is changed!
5. Sign off :-D

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Tomás Cohen Arazi (tcohen) 2023-08-15 08:24:53 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 8 Fridolin Somers 2023-08-17 19:24:11 UTC
Pushed to 23.05.x for 23.05.03
Comment 9 Pedro Amorim 2023-08-18 13:51:25 UTC
Nice work everyone!

Pushed to 22.11.x for next release