Koha-clms/t/db_dependent
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
..
Acquisition Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Auth Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
AuthoritiesMarc
…
Authority Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Biblio Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Budgets
…
Circulation Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
CourseReserves Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Creators Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Exporter Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Holds Bug 40058: Adjust existing tests 2025-08-14 16:06:00 -06:00
HoldsQueue Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Items Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha Bug 40154: prevent deletion of items with holds 2026-03-23 12:32:24 +00:00
LDAP Bug 39325: Manual fixes 2025-04-28 18:51:23 +02:00
Labels Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Letters Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Members Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
OAI Bug 40265: (try to) prevent OAI/Server.t to fail on slow server 2025-09-26 10:36:54 -06:00
Patron Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Record Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Reports Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Reserves Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
SIP Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Search Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Serials Bug 37796: (QA follow-up) nextpublisheddate in t/db../GetNextSeq.t 2026-01-16 12:59:57 +00:00
Template/Plugin Bug 37711: (follow-up) Fix AuthClient plugin database upgrade handling 2025-11-05 07:12:33 -07:00
Utils Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
api/v1 Bug 40154: prevent deletion of items with holds 2026-03-23 12:32:24 +00:00
cronjobs Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
data Bug 39345: (QA follow-up): Add exception handling for unsupported counter release 2025-09-05 15:10:31 -06:00
misc/translator Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings 2025-07-28 16:26:36 -06:00
mojo Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
selenium Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
www Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
00-strict.t
…
Accounts.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Acquisition.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Amazon.t
…
ArticleRequests.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
AudioAlerts.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Auth.t Bug 39745: Fix wrong system preference 'language' in test suite (mock_preference) 2026-03-14 12:21:04 +00:00
AuthUtils.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Auth_with_cas.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Auth_with_ldap.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Auth_with_shibboleth.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
AuthorisedValues.t Bug 40444: Add a test to ensure all Perl test files use Test::NoWarnings 2025-07-28 16:26:36 -06:00
AuthoritiesMarc.t
…
AuthoritiesMarc_GetTagsLabels.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Barcodes.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Barcodes_ValueBuilder.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Biblio.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Biblio_holdsqueue.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Breeding.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Breeding_Auth.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Budgets.t Bug 40371: Remove warnings from Budgets.t output 2025-07-23 16:36:30 -06:00
Cache.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
Charset.t
…
Circulation.t Bug 39014: Remove unnecessary tests 2026-01-16 17:10:57 +00:00
ClassSources.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Clubs.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Context.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Contract.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
CourseReserves.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
DecreaseLoanHighHolds.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Filter_MARC_ViewPolicy.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Fines.t
…
FrameworkPlugin.t Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Heading.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Heading_MARC21.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Hold.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Holds.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
HoldsQueue.t Bug 40680: Fix C4::Calendar imports 2025-12-01 08:34:00 -07:00
Holidays.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
ILSDI_Services.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
ImportBatch.t Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
ImportExportFramework.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Installer.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Items.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha.t Bug 40277: Add a test 2025-07-07 10:20:27 -06:00
Koha_Database.t
…
Koha_Elasticsearch.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha_ExternalContent_OverDrive.t
…
Koha_MetadataRecord_Authority.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Koha_Misc_Files.t
…
Languages.t Bug 39325: Manual fixes 2025-04-28 18:51:23 +02:00
Letters.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
LibraryGroups.t
…
Linker_Default.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Linker_FirstMatch.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Log.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
MarcModificationTemplates.t Bug 32950: Remove unecessary DELETE 2025-10-06 09:15:25 -06:00
Matcher.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Members.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Message.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
MungeMarcPrice.t
…
Output.t Bug 38936: Use https in license 2025-10-01 08:32:49 -06:00
Overdues.t Bug 40409: Remove warnings from t/db_dependent/Overdues.t 2025-07-18 11:10:00 -06:00
Passwordrecovery.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
PatronLists.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Patroncards.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Patrons.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Prices.t Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Realtime_holdsqueue.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Record.t
…
RecordProcessor_EmbedSeeFromHeadings.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Reports.t Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Reserves.t Bug 40960: Fix unit tests 2026-03-23 09:55:46 +00:00
RotatingCollections.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Search.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Search_FacetSorting.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Serials.t Bug 37796: Pass correct publication date when generating the next serial form the serial collection page 2026-01-16 12:59:57 +00:00
Serials_2.t
…
Service.t
…
ShelfBrowser.t
…
Sitemapper.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
SocialData.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
StockRotationItems.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
StockRotationRotas.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
StockRotationStages.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
SuggestionEngine_ExplodedTerms.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
TablesSettings.t Bug 41042: default_save_state is enabled by default 2025-10-23 11:33:32 -06:00
Tags.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Templates.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
TestBuilder.t Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Upload.t
…
UsageStats.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
Virtualshelves.t Bug 18148: Add unit tests 2025-11-05 07:12:35 -07:00
XISBN.t
…
XSLT.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
check_kohastructure.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
check_sysprefs.t Bug 41682: (RM follow-up) Fix spelling mistake 2026-03-14 12:21:04 +00:00
db_structure.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
rollingloans.t Bug 40680: Fix t tests 2025-12-01 08:34:01 -07:00
sysprefs.t Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
yaml.t
…
zebra_config.pl
…