From cd8bd04c3da71da56fffc47ca26b285293778205 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 18 Oct 2022 16:25:35 +0100 Subject: [PATCH] Bug 31224: Convert C4::Record::marcrecord2csv Update marcrecord2csv to user RecordProcessor directly for embedding listed items. --- C4/Record.pm | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/C4/Record.pm b/C4/Record.pm index 69a60f3520..9a4eead0c8 100644 --- a/C4/Record.pm +++ b/C4/Record.pm @@ -461,10 +461,22 @@ sub marcrecord2csv { my $biblio = Koha::Biblios->find($biblionumber); return unless $biblio; my $record = eval { - $biblio->metadata->record( - { embed_items => 1, itemnumbers => $itemnumbers } ); + $biblio->metadata->record; }; return unless $record; + + # Embed items + my $items = $biblio->items; + $items = $items->search( { itemnumber => { -in => $itemnumbers } } ) + if (@$itemnumber); + my $rp = Koha::RecordProcessor->new( + { + filters => ['EmbedItems'], + options => { items => $items } + } + ); + $rp->process($record); + # Getting the framework my $frameworkcode = $biblio->frameworkcode; -- 2.20.1