]> 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)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 20 Oct 2023 14:02:55 +0000 (11:02 -0300)
commit82e0edd87606ce05511b33ddeeea10f2b9e68f3d
treed93176bff5cb5d89860e151f81c53e50ed53ca99
parent683b74d202d57f4c3fdad62d81b92bf49f7d1fc4
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>
Koha/REST/V1/Holds.pm