Koha/Koha/Filter/MARC
Tomas Cohen Arazi 6189f25dfa
Bug 23793: Add an EmbedItems RecordProcessor filter for MARC::Record objects
This patch introduces a RecordProcessor filter for MARC::Record objects
that embeds MARC::Field's for each item that is passed to the processor.

Target usage:

my $biblio = Koha::Biblios->find(
    $biblio_id,
    { prefetch => [ items, metadata ] }
);

my $opachiddenitems_rules;
eval {
    my $yaml = C4::Context->preference('OpacHiddenItems') . "\n\n";
    $opachiddenitems_rules = YAML::Load($yaml);
};

my @items  = grep { !$_->hidden_in_opac({ rules => $opachiddenitems_rules }) @{$biblio->items->as_list};
my $record = $biblio->metadata->record;

my $processor = Koha::RecordProcessor->new(
    {
        filters => ('EmbedItems'),
        options => {
            items        => \@items
        }
    }
);

$processor->process( $record );

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-10-23 17:33:07 +01:00
..
EmbedItems.pm Bug 23793: Add an EmbedItems RecordProcessor filter for MARC::Record objects 2019-10-23 17:33:07 +01:00
EmbedItemsAvailability.pm
EmbedSeeFromHeadings.pm
Null.pm
ViewPolicy.pm