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

(-)a/Koha/Biblio.pm (-1 / +66 lines)
Lines 123-128 sub record_schema { Link Here
123
    return $self->metadata->schema // C4::Context->preference("marcflavour");
123
    return $self->metadata->schema // C4::Context->preference("marcflavour");
124
}
124
}
125
125
126
=head3 metadata_record
127
128
    my $record = $biblio->metadata_record(
129
        {
130
            [ embed_items => 1|0,
131
              opac        => 1|0,
132
              patron      => $patron,
133
              expand_coded_fields => 1|0 ]
134
        }
135
    );
136
137
Returns the metadata serialized as appropriate for the metadata object
138
type. Currently only I<MARC::Record> objects are returned.
139
140
=cut
141
142
sub metadata_record {
143
    my ($self, $params) = @_;
144
145
    my $patron = $params->{patron};
146
147
    my $record = $self->metadata->record;
148
149
    if ( $params->{embed_items} or $params->{opac} ) {
150
        # There's need for a RecordProcessor, let's do it!
151
        my @filters;
152
        my $options = {
153
            interface     => 'opac',
154
            frameworkcode => $self->frameworkcode,
155
        };
156
157
        if ($params->{embed_items}) {
158
            push @filters, 'EmbedItems';
159
            if ($params->{opac}) {
160
                $options->{items} = $self->items->filter_by_visible_in_opac(
161
                    {
162
                        ( $params->{patron} ? patron => $params->{patron} : ())
163
                    }
164
                );
165
            }
166
            else {
167
                $options->{items} = $self->items;
168
            }
169
        }
170
171
        if ( $params->{opac} ) {
172
            push @filters, 'ViewPolicy';
173
        }
174
175
        if ( $params->{expand_coded_fields} ) {
176
            push @filters, 'ExpandCodedFields';
177
        }
178
179
        my $rp = Koha::RecordProcessor->new(
180
            {
181
                filters => \@filters,
182
                options => $options
183
            }
184
        );
185
186
        $rp->process( $record );
187
    }
188
189
    return $record;
190
}
191
126
=head3 orders
192
=head3 orders
127
193
128
my $orders = $biblio->orders();
194
my $orders = $biblio->orders();
129
- 

Return to bug 31224