View | Details | Raw Unified | Return to bug 33188
Collapse All | Expand All

(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 962-968 sub hidden_in_opac { Link Here
962
962
963
    foreach my $field ( keys %{$rules} ) {
963
    foreach my $field ( keys %{$rules} ) {
964
964
965
        if ( any { $self->$field eq $_ } @{ $rules->{$field} } ) {
965
        if ( any { defined $self->$field && $self->$field eq $_ } @{ $rules->{$field} } ) {
966
            $hidden_in_opac = 1;
966
            $hidden_in_opac = 1;
967
            last;
967
            last;
968
        }
968
        }
(-)a/t/db_dependent/Koha/Item.t (-3 / +6 lines)
Lines 23-28 use utf8; Link Here
23
use Test::More tests => 38;
23
use Test::More tests => 38;
24
use Test::Exception;
24
use Test::Exception;
25
use Test::MockModule;
25
use Test::MockModule;
26
use Test::Warn;
26
27
27
use C4::Biblio qw( GetMarcSubfieldStructure );
28
use C4::Biblio qw( GetMarcSubfieldStructure );
28
use C4::Circulation qw( AddIssue AddReturn );
29
use C4::Circulation qw( AddIssue AddReturn );
Lines 410-416 subtest 'remove_from_bundle tests' => sub { Link Here
410
411
411
subtest 'hidden_in_opac() tests' => sub {
412
subtest 'hidden_in_opac() tests' => sub {
412
413
413
    plan tests => 4;
414
    plan tests => 5;
414
415
415
    $schema->storage->txn_begin;
416
    $schema->storage->txn_begin;
416
417
Lines 435-441 subtest 'hidden_in_opac() tests' => sub { Link Here
435
436
436
    ok( $item->hidden_in_opac({ rules => $rules }), 'Rule matching itype passed, should hide' );
437
    ok( $item->hidden_in_opac({ rules => $rules }), 'Rule matching itype passed, should hide' );
437
438
438
439
    $rules = { ccode => [ 'FOO' ] };
440
    $item = $item->ccode(undef)->store->get_from_storage;
441
    warning_is {
442
        $item->hidden_in_opac({ rules => $rules }) } undef, 'No warning from hidden_in_opac';
439
443
440
    $schema->storage->txn_rollback;
444
    $schema->storage->txn_rollback;
441
};
445
};
442
- 

Return to bug 33188