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