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 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Edit: tidied the tests (tcohen) Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> (cherry picked from commitf575d4cd73) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit1b27067e9a) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
d4db820adb
commit
ed9cdb267d
|
|
@ -843,7 +843,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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use utf8;
|
|||
use Test::More tests => 34;
|
||||
use Test::Exception;
|
||||
use Test::MockModule;
|
||||
use Test::Warn;
|
||||
|
||||
use C4::Biblio qw( GetMarcSubfieldStructure );
|
||||
use C4::Circulation qw( AddIssue AddReturn );
|
||||
|
|
@ -321,7 +322,7 @@ subtest 'remove_from_bundle tests' => sub {
|
|||
|
||||
subtest 'hidden_in_opac() tests' => sub {
|
||||
|
||||
plan tests => 4;
|
||||
plan tests => 5;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
|
|
@ -346,7 +347,12 @@ 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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue