Bugzilla – Attachment 129543 Details for
Bug 29690
Software error in details.pl when invalid MARCXML
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29690: Prevent detail.pl to crash if MARCXML is invalid
Bug-29690-Prevent-detailpl-to-crash-if-MARCXML-is-.patch (text/plain), 2.45 KB, created by
Fridolin Somers
on 2022-01-17 19:51:23 UTC
(
hide
)
Description:
Bug 29690: Prevent detail.pl to crash if MARCXML is invalid
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2022-01-17 19:51:23 UTC
Size:
2.45 KB
patch
obsolete
>From 81b2c7262c0dbaefec18644a38ca4f7c5e23080c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 13 Jan 2022 06:21:15 +0100 >Subject: [PATCH] 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> >--- > catalogue/detail.pl | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index bc28f29cc1..1146aa78d8 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -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}, >-- >2.34.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29690
:
128484
|
128485
|
128486
|
128487
|
128488
|
128497
|
128530
|
128531
|
128532
|
128533
|
128541
|
128578
|
129339
|
129340
|
129341
|
129342
|
129343
|
129344
|
129345
|
129365
|
129381
|
129382
|
129542
|
129543
|
129730
|
129731