[Koha-bugs] [Bug 23793] Add an EmbedItems RecordProcessor filter for MARC::Record objects

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Oct 23 08:53:15 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23793

Ere Maijala <ere.maijala at helsinki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #94095|0                           |1
        is obsolete|                            |

--- Comment #12 from Ere Maijala <ere.maijala at helsinki.fi> ---
Created attachment 94599
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=94599&action=edit
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 at helsinki.fi>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list