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

(-)a/C4/Search.pm (-9 / +5 lines)
Lines 621-635 sub GetFacets { Link Here
621
    }
621
    }
622
622
623
    if ( C4::Context->interface eq 'opac' ) {
623
    if ( C4::Context->interface eq 'opac' ) {
624
        for my $k ( keys %$facets ) {
624
        my @itype_facets = keys %{ $facets->{'itype'} };
625
            if ( $k eq 'itype' ) {
625
        if( @itype_facets ){
626
                my $itemtypes = Koha::ItemTypes->new;
626
            my $hidden_itemtypes = Koha::ItemTypes->search({ hideinopac => 1 });
627
                for my $fv ( keys %{ $facets->{$k} } ) {
627
            while( my $hi = $hidden_itemtypes->next ){
628
                    my $itemtype = $itemtypes->find($fv);
628
                delete $facets->{'itype'}->{$hi->itemtype};
629
                    if ( defined $itemtype && $itemtype->hideinopac ) {
630
                        delete $facets->{$k}->{$fv};
631
                    }
632
                }
633
            }
629
            }
634
        }
630
        }
635
    }
631
    }
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (-3 / +2 lines)
Lines 459-465 sub _convert_facets { Link Here
459
        homebranch => $library_names
459
        homebranch => $library_names
460
    );
460
    );
461
461
462
    my @hidden_itemtypes = map { $_->itemtype } ( grep { $opac && $_->hideinopac } @itypes );
462
    my %hidden_itemtypes = map { $_->itemtype => 1 } ( grep { $opac && $_->hideinopac } @itypes );
463
463
464
    my @facets;
464
    my @facets;
465
    $exp_facet //= '';
465
    $exp_facet //= '';
Lines 481-487 sub _convert_facets { Link Here
481
            next unless length($t); # FIXME Currently we cannot search for an empty faceted field i.e. ln:"" to find records missing languages, though ES does count them correctly
481
            next unless length($t); # FIXME Currently we cannot search for an empty faceted field i.e. ln:"" to find records missing languages, though ES does count them correctly
482
            my $c = $term->{doc_count};
482
            my $c = $term->{doc_count};
483
            my $label;
483
            my $label;
484
            next if $type eq 'itype' && grep { $_ eq $t } @hidden_itemtypes;
484
            next if $type eq 'itype' && $hidden_itemtypes{ $t };
485
            if ( exists( $special{$type} ) ) {
485
            if ( exists( $special{$type} ) ) {
486
                $label = $special{$type}->{$t} // $t;
486
                $label = $special{$type}->{$t} // $t;
487
            }
487
            }
488
- 

Return to bug 14007