From 00e45a3a016f52dc6e13a2f9cb84d2bddb2ac4fa Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Jun 2022 11:38:02 +0200 Subject: [PATCH] Bug 27272: misc/migration_tools/rebuild_zebra.pl Hum... Item2Marc ok here? --- 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 fb16b8b360a..ec19ce1f5c4 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.25.1