Bugzilla – Attachment 173647 Details for
Bug 33188
Warning in Koha::Items->hidden_in_opac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33188: Remove warning from Koha::Item->hidden_in_opac
Bug-33188-Remove-warning-from-KohaItem-hiddeninopa.patch (text/plain), 1.89 KB, created by
Jonathan Druart
on 2024-10-29 13:42:31 UTC
(
hide
)
Description:
Bug 33188: Remove warning from Koha::Item->hidden_in_opac
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-29 13:42:31 UTC
Size:
1.89 KB
patch
obsolete
>From 0f84d7ebf4395f56fd49e69e6a7315b0cbf71fb0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 29 Oct 2024 14:41:19 +0100 >Subject: [PATCH] Bug 33188: Remove warning from Koha::Item->hidden_in_opac > >"Use of uninitialized value in string eq" > >Test plan: > prove t/db_dependent/Koha/Item.t >should return green >--- > Koha/Item.pm | 2 +- > t/db_dependent/Koha/Item.t | 8 ++++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 16f66a8c68e..334813fbf6f 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -960,7 +960,7 @@ sub hidden_in_opac { > > foreach my $field ( keys %{$rules} ) { > >- if ( any { $self->$field eq $_ } @{ $rules->{$field} } ) { >+ if ( any { defined $self->$field && $self->$field eq $_ } @{ $rules->{$field} } ) { > $hidden_in_opac = 1; > last; > } >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 3e290a8d9e0..f15c9cba01d 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -23,6 +23,7 @@ use utf8; > use Test::More tests => 38; > use Test::Exception; > use Test::MockModule; >+use Test::Warn; > > use C4::Biblio qw( GetMarcSubfieldStructure ); > use C4::Circulation qw( AddIssue AddReturn ); >@@ -410,7 +411,7 @@ subtest 'remove_from_bundle tests' => sub { > > subtest 'hidden_in_opac() tests' => sub { > >- plan tests => 4; >+ plan tests => 5; > > $schema->storage->txn_begin; > >@@ -435,7 +436,10 @@ subtest 'hidden_in_opac() tests' => sub { > > ok( $item->hidden_in_opac({ rules => $rules }), 'Rule matching itype passed, should hide' ); > >- >+ $rules = { ccode => [ 'FOO' ] }; >+ $item = $item->ccode(undef)->store->get_from_storage; >+ warning_is { >+ $item->hidden_in_opac({ rules => $rules }) } undef, 'No warning from hidden_in_opac'; > > $schema->storage->txn_rollback; > }; >-- >2.34.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 33188
:
173647
|
173732
|
173733