View | Details | Raw Unified | Return to bug 29764
Collapse All | Expand All

(-)a/Koha/Filter/MARC/EmbedItems.pm (-12 / +7 lines)
Lines 23-48 Koha::Filter::MARC::EmbedItems - Appends item information on MARC::Record object Link Here
23
23
24
=head1 SYNOPSIS
24
=head1 SYNOPSIS
25
25
26
my $biblio = Koha::Biblios->find(
26
my $patron = Koha::Patrons->find($loggedinuser);
27
    $biblio_id,
28
    { prefetch => [ items, metadata ] }
29
);
30
31
my $rules = C4::Context->yaml_preference('OpacHiddenItems');
32
27
33
my @items  = grep { !$_->hidden_in_opac({ rules => $rules }) @{$biblio->items};
34
my $record = $biblio->metadata->record;
28
my $record = $biblio->metadata->record;
29
my @items  = $biblio->items->filter_by_visible_in_opac({ patron => $patron })->as_list;
35
30
36
my $processor = Koha::RecordProcessor->new(
31
my $record_processor = Koha::RecordProcessor->new(
37
    {
32
    {
38
        filters => ('EmbedItems'),
33
        filters => ['EmbedItems'],
39
        options => {
34
        options => {
40
            items        => \@items
35
            interface => 'opac',
36
            items     => \@items
41
        }
37
        }
42
    }
38
    }
43
);
39
);
44
40
45
$processor->process( $record );
41
$record_processor->process($record);
46
42
47
=head1 DESCRIPTION
43
=head1 DESCRIPTION
48
44
49
- 

Return to bug 29764