From bd70e8989fc02040a751f13c7d291d40e2dd91d7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Jun 2022 11:38:02 +0200 Subject: [PATCH] Bug 31312: Remove GetItemsInfo from misc/migration_tools/rebuild_zebra.pl Hum... Item2Marc ok here? Bug 27272 is going to remove C4::Items::GetItemsInfo in favour of Koha::Items->search. Here we are going to deal with misc/migration_tools/rebuild_zebra.pl Test plan: I am not sure, what do we want to test here? Items' info indexed correctly? Signed-off-by: Owen Leonard Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- misc/migration_tools/rebuild_zebra.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index 6dbce38736..a73e7bdd2f 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -25,7 +25,7 @@ use File::Temp qw( tempdir ); use File::Path qw( mkpath rmtree ); use C4::Biblio qw( GetXmlBiblio ); use C4::AuthoritiesMarc qw( GetAuthority GetAuthorityXML ); -use C4::Items qw( GetItemsInfo Item2Marc ); +use C4::Items qw( Item2Marc ); use Koha::RecordProcessor; use Koha::Caches; use XML::LibXML; @@ -509,12 +509,14 @@ sub export_marc_records_from_sth { ? GetXmlBiblio( $record_number ) : GetAuthorityXML( $record_number ); if ($record_type eq 'biblio'){ - my @items = GetItemsInfo($record_number); - if (@items){ + my $biblio = Koha::Biblios->find($record_number); + next unless $biblio; + my $items = $biblio->items; + if ($items->count){ my $record = MARC::Record->new; $record->encoding('UTF-8'); my @itemsrecord; - foreach my $item (@items){ + for my $item ( @{$items->unblessed} ) { my $record = Item2Marc($item, $record_number); push @itemsrecord, $record->field($itemtag); } -- 2.39.5