Bug 29690: Prevent detail.pl to crash if MARCXML is invalid
Bug 23846 added support for invalid MARCXML. But now page details.pl fails again with software error. This comes from several Koha::Biblio calling $self->metadata->record without eval. Test plan : 1) Create a biblio record with invalid MARCXML (see Bug 29690) In koha-testing-docker there is biblionumber=369 2) Go to page cgi-bin/koha/catalogue/detail.pl?biblionumber=xxx 3) You see the page with a message : There is an error with this bibliographic record, the view may be degraded. Error: Invalid data, cannot decode metadata object ... Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
78cb924b12
commit
11a018aa30
1 changed files with 3 additions and 5 deletions
|
@ -95,7 +95,7 @@ if ( not defined $record ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
eval { $biblio->metadata->record };
|
||||
my $marc_record = eval { $biblio->metadata->record };
|
||||
$template->param( decoding_error => $@ );
|
||||
|
||||
if($query->cookie("holdfor")){
|
||||
|
@ -145,8 +145,6 @@ $template->param(
|
|||
normalized_isbn => $isbn,
|
||||
);
|
||||
|
||||
my $marcnotesarray = $biblio->get_marc_notes({ marcflavour => $marcflavour });
|
||||
|
||||
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
@ -221,7 +219,7 @@ if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
|
|||
$template->param( ComponentPartsQuery => $biblio->get_components_query );
|
||||
}
|
||||
} else { # check if we should show analytics anyway
|
||||
$show_analytics = 1 if @{$biblio->get_marc_components(1)}; # count matters here, results does not
|
||||
$show_analytics = 1 if $marc_record && @{$biblio->get_marc_components(1)}; # count matters here, results does not
|
||||
$template->param( analytics_error => 1 ) if grep { $_->message eq 'component_search' } @{$biblio->messages};
|
||||
}
|
||||
|
||||
|
@ -452,7 +450,7 @@ $template->param(
|
|||
);
|
||||
|
||||
$template->param(
|
||||
MARCNOTES => $marcnotesarray,
|
||||
MARCNOTES => $marc_record ? $biblio->get_marc_notes({ marcflavour => $marcflavour }) : (),
|
||||
itemdata_ccode => $itemfields{ccode},
|
||||
itemdata_enumchron => $itemfields{enumchron},
|
||||
itemdata_uri => $itemfields{uri},
|
||||
|
|
Loading…
Reference in a new issue