|
Lines 176-182
sub get_biblio_marcxml {
Link Here
|
| 176 |
my $with_items = 0; |
176 |
my $with_items = 0; |
| 177 |
my $expanded_avs = 0; |
177 |
my $expanded_avs = 0; |
| 178 |
if ( my $conf = $self->{conf} ) { |
178 |
if ( my $conf = $self->{conf} ) { |
| 179 |
$with_items = $conf->{format}->{$format}->{include_items }; |
179 |
$with_items = $conf->{format}->{$format}->{include_items}; |
| 180 |
$expanded_avs = $conf->{format}->{$format}->{expanded_avs}; |
180 |
$expanded_avs = $conf->{format}->{$format}->{expanded_avs}; |
| 181 |
} |
181 |
} |
| 182 |
|
182 |
|
|
Lines 185-197
sub get_biblio_marcxml {
Link Here
|
| 185 |
|
185 |
|
| 186 |
# Koha::Biblio::Metadata->record throws an exception on bad encoding, |
186 |
# Koha::Biblio::Metadata->record throws an exception on bad encoding, |
| 187 |
# we don't want OAI harvests to die, so we catch and warn, and try to clean the record |
187 |
# we don't want OAI harvests to die, so we catch and warn, and try to clean the record |
| 188 |
eval { $record = $biblio->metadata->record( { embed_items => $with_items, opac => 1 } ); }; |
188 |
eval { |
|
|
189 |
$record = $biblio->metadata->record( |
| 190 |
{ |
| 191 |
embed_items => $with_items, opac => 1, |
| 192 |
suppress_if_items_hidden => C4::Context->preference('OpacHiddenItemsHidesRecord') |
| 193 |
} |
| 194 |
); |
| 195 |
}; |
| 189 |
my $decoding_error; |
196 |
my $decoding_error; |
| 190 |
if ($@) { |
197 |
if ($@) { |
| 191 |
my $exception = $@; |
198 |
my $exception = $@; |
| 192 |
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); |
199 |
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') ); |
| 193 |
$decoding_error = "INVALID_METADATA"; |
200 |
$decoding_error = "INVALID_METADATA"; |
| 194 |
$record = $biblio->metadata->record_strip_nonxml( { embed_items => $with_items, opac => 1 } ); |
201 |
$record = $biblio->metadata->record_strip_nonxml( |
|
|
202 |
{ |
| 203 |
embed_items => $with_items, opac => 1, |
| 204 |
suppress_if_items_hidden => C4::Context->preference('OpacHiddenItemsHidesRecord') |
| 205 |
} |
| 206 |
); |
| 207 |
} |
| 208 |
if ( $biblio && !$record ){ |
| 209 |
# We had a biblio, but didn't get a record, assuming it was suppressed by hidden items (otherwise should have been error) |
| 210 |
return( undef, undef, "hidden_by_hidden_items" ); |
| 195 |
} |
211 |
} |
| 196 |
if ( $record && $expanded_avs ) { |
212 |
if ( $record && $expanded_avs ) { |
| 197 |
my $frameworkcode = GetFrameworkCode($biblionumber) || ''; |
213 |
my $frameworkcode = GetFrameworkCode($biblionumber) || ''; |