From 79c44222527f48873dbe3a210a58fc98ec53f31e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Jul 2025 10:29:45 +0200 Subject: [PATCH] Bug 34200: Move lists when merging records This is the naive approach, but it's not enough. * If the 2 records were in the same list then the resulting record will appear twice in the list * What if the record that is going to be deleted was in a private list and the the logged in user does not have permission to edit it? Also we are missing tests. --- Koha/Biblio.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 0df2b489a73..b1099e55d88 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -62,6 +62,7 @@ use Koha::SearchEngine; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; use Koha::Tickets; +use Koha::Virtualshelfcontents; =head1 NAME @@ -2336,6 +2337,12 @@ sub merge_with { { no_triggers => 1 } ); + # Move lists + Koha::Virtualshelfcontents->search( { biblionumber => $from_biblio->biblionumber } )->update( + { biblionumber => $ref_biblionumber }, + { no_triggers => 1 } + ); + my $orders = $from_biblio->orders->unblessed; for my $order (@$orders) { $order->{'biblionumber'} = $ref_biblionumber; -- 2.34.1