Bugzilla – Attachment 128484 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: Add eval on metadata record fetch in details.pl when invalid MARCXML
Bug-29690-Add-eval-on-metadata-record-fetch-in-det.patch (text/plain), 2.85 KB, created by
Fridolin Somers
on 2021-12-14 06:27:01 UTC
(
hide
)
Description:
Bug 29690: Add eval on metadata record fetch in details.pl when invalid MARCXML
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-12-14 06:27:01 UTC
Size:
2.85 KB
patch
obsolete
>From e0d854ac677d4f73d8c04600d00b215c204489c3 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Mon, 13 Dec 2021 20:21:54 -1000 >Subject: [PATCH] Bug 29690: Add eval on metadata record fetch in details.pl > when invalid MARCXML > >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 ... >--- > Koha/Biblio.pm | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index c4c12128af..2101fe28bc 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -563,15 +563,18 @@ sub get_components_query { > > my $builder = Koha::SearchEngine::QueryBuilder->new( > { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); >- my $marc = $self->metadata->record; >+ >+ my $record; >+ eval { $record = $self->metadata->record }; >+ return if !$record; > > my $searchstr; > if ( C4::Context->preference('UseControlNumber') ) { >- my $pf001 = $marc->field('001') || undef; >+ my $pf001 = $record->field('001') || undef; > > if ( defined($pf001) ) { > $searchstr = "("; >- my $pf003 = $marc->field('003') || undef; >+ my $pf003 = $record->field('003') || undef; > > if ( !defined($pf003) ) { > # search for 773$w='Host001' >@@ -591,7 +594,7 @@ sub get_components_query { > } > } > else { >- my $cleaned_title = $marc->subfield('245', "a"); >+ my $cleaned_title = $record->subfield('245', "a"); > $cleaned_title =~ tr|/||; > $cleaned_title = $builder->clean_search_term($cleaned_title); > $searchstr = "Host-item:($cleaned_title)"; >@@ -650,7 +653,9 @@ Returns the COinS (a span) which can be included in a biblio record > sub get_coins { > my ( $self ) = @_; > >- my $record = $self->metadata->record; >+ my $record; >+ eval { $record = $self->metadata->record }; >+ return if !$record; > > my $pos7 = substr $record->leader(), 7, 1; > my $pos6 = substr $record->leader(), 6, 1; >@@ -940,7 +945,11 @@ sub get_marc_notes { > > my %hiddenlist = map { $_ => 1 } > split( /,/, C4::Context->preference('NotesToHide')); >- my $record = $self->metadata->record; >+ >+ my $record; >+ eval { $record = $self->metadata->record }; >+ return if !$record; >+ > $record = transformMARCXML4XSLT( $self->biblionumber, $record, $opac ); > > foreach my $field ( $record->field($scope) ) { >-- >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