From 37bf88d252c7efda0301b8f3624dcf02ebb7e187 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 2 Feb 2023 15:58:10 +0000 Subject: [PATCH] Bug 32800: Don't embed items for deleted records To test: 1 - Delete a biblio 2 - perl /kohadevbox/koha/misc/migration_tools/build_oai_sets.pl -v -i -r 3 - Error: Can't call method "items" on an undefined value at /kohadevbox/koha/Koha/Biblio/Metadata.pm line 163. 4 - Apply patch 5 - Repeat 6 - Success! Signed-off-by: Magnus Enger Works as advertised. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- misc/migration_tools/build_oai_sets.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/migration_tools/build_oai_sets.pl b/misc/migration_tools/build_oai_sets.pl index 0ab07bcd91..a312d3e0f9 100755 --- a/misc/migration_tools/build_oai_sets.pl +++ b/misc/migration_tools/build_oai_sets.pl @@ -79,12 +79,12 @@ my $mappings = GetOAISetsMappings; # Get all biblionumbers and marcxml print "Retrieving biblios... " if $verbose; my $query = qq{ - SELECT biblionumber, metadata + SELECT biblionumber, metadata, 0 as "deleted" FROM biblio_metadata WHERE format='marcxml' AND `schema` = ? UNION - SELECT biblionumber, metadata + SELECT biblionumber, metadata, 1 as "deleted" FROM deletedbiblio_metadata WHERE format='marcxml' AND `schema` = ? @@ -140,7 +140,7 @@ foreach my $res (@$results) { warn "(biblio $biblionumber) Error while creating record from marcxml: $@"; next; } - if($embed_items) { + if( $embed_items && !($res->{'deleted'}) ) { $record = Koha::Biblio::Metadata->record( { record => $record,