]> git.koha-community.org Git - koha.git/commit
Bug 35053: Make sure request is checked as an item-level request if item_id passed
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 17 Oct 2023 12:07:28 +0000 (09:07 -0300)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Mon, 13 Nov 2023 14:03:04 +0000 (14:03 +0000)
commit88bd912254340aa1f6d449364f70745e92c0fc22
tree74e5c725df30bcdc00dfd77cbec689bc564c5c74
parent1058c877e497ae77798b05e601a466f8280abd70
Bug 35053: Make sure request is checked as an item-level request if item_id passed

This patch makes the validation code have the `$item` variable defined
when checking holdability, in the case both `item_id` and `biblio_id`
params are passed.

Otherwise, if the requested item is not holdable, but a biblio-level
hold *could* be placed, the item-level hold is placed.

This is highlighted by the regression tests.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests don't pass. A request that should be rejected is allowed
because biblio-level hold is allowed.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Item-level rules are checked and thus the
request rejected (code 403)
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 82e0edd87606ce05511b33ddeeea10f2b9e68f3d)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 8a945f3e811cfb39c0a0212554b1adfca2b041bb)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/REST/V1/Holds.pm