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

(-)a/Koha/Biblio.pm (-1 / +55 lines)
Lines 88-93 sub metadata { Link Here
88
    return Koha::Biblio::Metadata->_new_from_dbic($metadata);
88
    return Koha::Biblio::Metadata->_new_from_dbic($metadata);
89
}
89
}
90
90
91
=head3 metadata_record
92
93
    my $record = $biblio->metadata_record(
94
        {
95
            [ embed_items => 1|0,
96
              opac        => 1|0,
97
              patron      => $patron, ]
98
        }
99
    );
100
101
Returns the metadata serialized as appropriate for the metadata object
102
type. Currently only I<MARC::Record> objects are returned.
103
104
=cut
105
106
sub metadata_record {
107
    my ($self, $params) = @_;
108
109
    my $patron = $params->{patron};
110
111
    my $record = $self->metadata->record;
112
113
    if ( $params->{embed_items} or $params->{opac} ) {
114
        # There's need for a RecordProcessor, let's do it!
115
        my @filters;
116
        my $options = {};
117
118
        if ($params->{embed_items}) {
119
            push @filters, 'EmbedItems';
120
            $options->{items} = $self->items->filter_by_visible_in_opac(
121
                {
122
                    ( $params->{patron} ? patron => $params->{patron} : ())
123
                }
124
            );
125
        }
126
127
        if ( $params->{opac} ) {
128
            push @filters, 'ViewPolicy';
129
            $options->{interface}     = 'opac';
130
            $options->{frameworkcode} = $self->frameworkcode;
131
        }
132
133
        my $rp = Koha::RecordProcessor->new(
134
            {
135
                filters => \@filters,
136
                options => $options
137
            }
138
        );
139
140
        $rp->process( $record );
141
    }
142
143
    return $record;
144
}
145
91
=head3 orders
146
=head3 orders
92
147
93
my $orders = $biblio->orders();
148
my $orders = $biblio->orders();
94
- 

Return to bug 31224