Bug 40154 - Deleting an item does not warn about an item level hold
Summary: Deleting an item does not warn about an item level hold
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Johanna Räisä
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-17 07:36 UTC by Anni Mäki-Mantila
Modified: 2025-08-21 16:39 UTC (History)
3 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 40154: prevent deletion of items with holds (9.05 KB, patch)
2025-08-07 10:56 UTC, Johanna Räisä
Details | Diff | Splinter Review
Bug 40154: prevent deletion of items with holds (9.14 KB, patch)
2025-08-14 16:49 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 40154: (follow-up) Minor tidy (930 bytes, patch)
2025-08-14 16:49 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Anni Mäki-Mantila 2025-06-17 07:36:43 UTC
At the moment, Koha doesn't give any warning if user is deleting an item that has a hold attached to it. Item is simply deleted and the item level hold vanishes as well.

To reproduce:

1. Make an item level hold

2. Delete the item using alternative A or B:

A: Open the biblios Detail-view -> From the toolbar, open "Edit"-dropdown menu -> Manage items -> Delete the item that has an item level hold attached to it from "Actions"-dropdown menu
B: Open the biblios Detail-view -> Select the item that has an item level hold attached to it -> Click "Delete selected items" -> Confirm deletion

3. Notice that the item is deleted without any warning and the item level hold has disappeared

4. Run following sql report: SELECT * FROM old_reserves WHERE biblionumber = [biblionumber you used in the test]

5. Notice that the item level hold is not found in old_reserves-table
Comment 1 Johanna Räisä 2025-08-07 10:56:03 UTC
Created attachment 185216 [details] [review]
Bug 40154: prevent deletion of items with holds

This patch prevents deletion of items that have item level holds on them.

Test plan:
1. Create an item level hold.
2. Delete the item using alternative A or B:
   A. Open the biblios Detail-view -> From the toolbar, open "Edit"-dropdown menu -> Manage items -> Delete the item that has an item level hold attached to it from "Actions"-dropdown menu
   B. Open the biblios Detail-view -> Select the item that has an item level hold attached to it -> Click "Delete selected items" -> Confirm deletion
3. Notice that the item is deleted without any warning and the item level hold has disappeared.
4. Apply this patch.
5. Repeat steps 1-3.
6. Notice that the item cannot be deleted and a warning is shown.
7. prove t/db_dependent/Koha/Item.t
8. Run the REST API tests: prove t/db_dependent/api/v1/items.t

Sponsored-by: Koha-Suomi Oy
Comment 2 Owen Leonard 2025-08-14 16:49:52 UTC
Created attachment 185406 [details] [review]
Bug 40154: prevent deletion of items with holds

This patch prevents deletion of items that have item level holds on
them.

Test plan:
1. Create an item level hold.
2. Delete the item using alternative A or B:
   A. Open the biblios Detail-view -> From the toolbar, open
      "Edit"-dropdown menu -> Manage items -> Delete the item that has
      an item level hold attached to it from "Actions"-dropdown menu
   B. Open the biblios Detail-view -> Select the item that has an item
      level hold attached to it -> Click "Delete selected items" ->
      Confirm deletion
3. Notice that the item is deleted without any warning and the item
   level hold has disappeared.
4. Apply this patch.
5. Repeat steps 1-3.
6. Notice that the item cannot be deleted and a warning is shown.
7. prove t/db_dependent/Koha/Item.t
8. Run the REST API tests: prove t/db_dependent/api/v1/items.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Owen Leonard 2025-08-14 16:49:54 UTC
Created attachment 185407 [details] [review]
Bug 40154: (follow-up) Minor tidy

Signed-off-by: Owen Leonard <oleonard@myacpl.org>