Bugzilla – Attachment 128531 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: (follow-up) Catch other cases
Bug-29690-follow-up-Catch-other-cases.patch (text/plain), 2.27 KB, created by
David Nind
on 2021-12-14 17:28:43 UTC
(
hide
)
Description:
Bug 29690: (follow-up) Catch other cases
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-12-14 17:28:43 UTC
Size:
2.27 KB
patch
obsolete
>From 50a48a5dfc44512862a2538eed4197e18384bdcc Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 14 Dec 2021 08:09:52 +0000 >Subject: [PATCH] Bug 29690: (follow-up) Catch other cases > >This patch catches the rest of the cases in Koha::Biblio where >`->metadata->record` may fail. > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/Biblio.pm | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 2101fe28bc..d5cf1cbb50 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -426,9 +426,13 @@ sub host_items { > elsif ( $marcflavour eq 'UNIMARC' ) { > $analyticfield = '461'; > } >- my $marc_record = $self->metadata->record; >+ >+ my $record; >+ $record = eval { $self->metadata->record; }; >+ return if !$record; >+ > my @itemnumbers; >- foreach my $field ( $marc_record->field($analyticfield) ) { >+ foreach my $field ( $record->field($analyticfield) ) { > push @itemnumbers, $field->subfield('9'); > } > >@@ -848,7 +852,10 @@ sub is_serial { > > return 1 if $self->serial; > >- my $record = $self->metadata->record; >+ my $record; >+ eval { $record = $self->metadata->record }; >+ return 0 if !$record; >+ > return 1 if substr($record->leader, 7, 1) eq 's'; > > return 0; >@@ -886,12 +893,16 @@ sub custom_cover_image_url { > if ( $url =~ $re ) { > my $field = $+{field}; > my $subfield = $+{subfield}; >- my $marc_record = $self->metadata->record; >+ >+ my $record; >+ eval { $record = $self->metadata->record }; >+ return "" if !$record; >+ > my $value; > if ( $subfield ) { >- $value = $marc_record->subfield( $field, $subfield ); >+ $value = $record->subfield( $field, $subfield ); > } else { >- my $controlfield = $marc_record->field($field); >+ my $controlfield = $record->field($field); > $value = $controlfield->data() if $controlfield; > } > return unless $value; >@@ -948,7 +959,7 @@ sub get_marc_notes { > > my $record; > eval { $record = $self->metadata->record }; >- return if !$record; >+ return [] if !$record; > > $record = transformMARCXML4XSLT( $self->biblionumber, $record, $opac ); > >-- >2.20.1
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