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