Bugzilla – Attachment 128488 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: Always warn if something is wrong with the metadata
Bug-29690-Always-warn-if-something-is-wrong-with-t.patch (text/plain), 2.31 KB, created by
Jonathan Druart
on 2021-12-14 09:56:27 UTC
(
hide
)
Description:
Bug 29690: Always warn if something is wrong with the metadata
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-12-14 09:56:27 UTC
Size:
2.31 KB
patch
obsolete
>From 5edd7fa29772677442e17c6a3a644ed81248955a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 Dec 2021 10:56:08 +0100 >Subject: [PATCH] Bug 29690: Always warn if something is wrong with the > metadata > >--- > Koha/Biblio.pm | 10 ++++------ > t/db_dependent/Koha/Biblio.t | 7 +++++-- > 2 files changed, 9 insertions(+), 8 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index d5cf1cbb509..37a90e4f2b4 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -427,9 +427,8 @@ sub host_items { > $analyticfield = '461'; > } > >- my $record; >- $record = eval { $self->metadata->record; }; >- return if !$record; >+ my $record = eval { $self->metadata->record }; >+ unless ( $record ) { warn $@ ; return } > > my @itemnumbers; > foreach my $field ( $record->field($analyticfield) ) { >@@ -568,9 +567,8 @@ sub get_components_query { > my $builder = Koha::SearchEngine::QueryBuilder->new( > { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); > >- my $record; >- eval { $record = $self->metadata->record }; >- return if !$record; >+ my $record = eval { $self->metadata->record }; >+ unless ( $record ) { warn $@ ; return } > > my $searchstr; > if ( C4::Context->preference('UseControlNumber') ) { >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 8331de65633..c9ac2bc96b6 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -565,7 +565,7 @@ subtest 'get_marc_components() tests' => sub { > }; > > subtest 'get_components_query' => sub { >- plan tests => 4; >+ plan tests => 5; > > my $biblio = $builder->build_sample_biblio(); > my $biblionumber = $biblio->biblionumber; >@@ -592,7 +592,10 @@ subtest 'get_components_query' => sub { > $biblio->metadata->metadata('This is invalid for a MARC record')->store(); > $biblio = Koha::Biblios->find( $biblio->biblionumber); > >- is($biblio->get_components_query, undef, "Invalid MARC record returns undefined and does not die"); >+ my $components_query; >+ warning_like { $biblio->get_components_query } >+ qr{^Invalid data, cannot decode metadata object}; >+ is( $components_query, undef, "Invalid MARC record returns undefined and does not die"); > }; > > subtest 'orders() and active_orders() tests' => sub { >-- >2.25.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