Koha-clms/t/db_dependent/Koha
Olli Kautonen f6aa530c07
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>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9445ffc9aa)
Signed-off-by: Chloé Zermatten <chloe.zermatten@openfifth.co.uk>
2026-03-23 12:32:24 +00:00
..
Account Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Acquisition Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Auth Bug 33782: (QA follow-up) Fix qa issues 2026-03-23 12:05:03 +00:00
BackgroundJob Bug 40846: Improve handling of ignored records 2026-02-16 14:43:00 +00:00
BackgroundJobs Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Biblio Bug 41031: Fix the subtest check_fixed_length in MARC21.t 2025-12-01 12:53:43 -07:00
Cash Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Charges Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Checkouts Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
CirculationRules Bug 38944: Add Test::NoWarnings to tests no producing warnings 2025-03-13 17:25:03 +01:00
Club Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Config Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Database Bug 40777: Add tests for for_biblio 2026-02-16 14:34:33 +00:00
ERM Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Edifact Bug 20253: (follow-up) Use purchase order number in BGM segment for outgoing ORDER messages 2025-11-03 14:13:38 -07:00
File Bug 38489: Add rename_file method to transport system and Local transport class 2025-10-14 14:51:47 -06:00
Filter Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ILL Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Import Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Item Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Items Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Library Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Notice Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
OAI/Server Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Object Bug 32370: (QA follow-up) Add https to license url, use Test::NoWarnings 2026-02-16 15:20:24 +00:00
Objects Bug 35451: Fix test data 2025-11-07 10:54:06 -07:00
Old Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Patron Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Patrons Bug 41145: Add unit test coverage for stopping duplicated borrowerslog logging due to extended patron attributes being deleted on import 2026-01-16 12:59:57 +00:00
Plugins Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Policy Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Preservation Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
REST Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
SIP2 Bug 37893: Handle SIPconfig.xml not found / unreadable 2025-11-26 10:40:35 -07:00
SMTP Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
SearchEngine Bug 40966: Regression tests 2026-03-16 13:23:10 +00:00
Subscription Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Tags Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Template/Plugin Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Ticket Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
UI/Form/Builder Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
XSLT Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Z3950Responder Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Account.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
ActionLogs.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
AdditionalContents.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
AdditionalField.t Bug 38944: Add Test::NoWarnings to tests no producing warnings 2025-03-13 17:25:03 +01:00
ApiKey.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ArticleRequest.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ArticleRequests.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Authorities.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Authority.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
BackgroundJob.t Bug 40943: Fix Koha/BackgroundJob.t 2025-11-04 07:15:11 -07:00
BackgroundJobs.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Biblio.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
BiblioFrameworks.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Biblios.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Booking.t Bug 40134: Add unit tests for optimal item selection 2026-03-23 11:44:26 +00:00
Bookings.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Calendar.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Checkout.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Checkouts.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
CirculationRules.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Cities.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ClassSortRules.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ClassSources.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ClassSplitRules.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Course.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Courses.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
CoverImages.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
CsvProfiles.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
CurbsidePickups.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Database.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Desks.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
EDI.t Bug 20253: (follow-up) Fix undefined variable $b and test plan count 2025-11-03 14:13:40 -07:00
Encryption.t Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings 2025-07-28 16:26:36 -06:00
Hold.t Bug 41456: Fix item type searching and filtering on the holds history table 2026-01-16 17:08:16 +00:00
Holds.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Installer.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Item.t Bug 40154: prevent deletion of items with holds 2026-03-23 12:32:24 +00:00
ItemTypes.t Bug 39745: Fix wrong system preference 'language' in test suite (mock_preference) 2026-03-14 12:21:04 +00:00
Items.t Bug 41298: Fix filtering items by in transit 2025-12-01 08:34:04 -07:00
KeyboardShortcuts.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Libraries.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Library.t Bug 39482: (follow-up) Adjust tests 2026-01-16 17:00:12 +00:00
MarcOrder.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
MarcSubfieldStructures.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Notice_Util.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Notices.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
OAIHarvester.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
OAIServers.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Object.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Objects.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Old.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Patron.t Bug 39014: (follow-up) Refactoring and renaming to can_be_guaranteed_by 2026-01-16 17:10:49 +00:00
Patron_generate_userid.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Patrons.t Bug 36360: Add tests 2026-03-16 13:23:09 +00:00
Pseudonymization.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
PseudonymizedTransaction.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Quotes.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Ratings.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Recall.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Recalls.t Bug 39985: Set items.onloan when recall adjusts checkout due date 2025-12-01 08:34:05 -07:00
RecordSource.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Reports.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Reviews.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
SMS_Providers.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
SearchField.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
SearchFilters.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Session.t Bug 38944: Add Test::NoWarnings to tests no producing warnings 2025-03-13 17:25:03 +01:00
SharedContent.t Bug 39745: Fix wrong system preference 'language' in test suite (mock_preference) 2026-03-14 12:21:04 +00:00
Statistic.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Statistics.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Subscription.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Suggestion.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Suggestions.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Tags.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Ticket.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Virtualshelf.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Virtualshelves.t Bug 39145: (follow-up) Tidy files 2025-09-29 14:02:26 -06:00
Z3950Servers.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00