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

(-)a/C4/Search.pm (+14 lines)
Lines 619-624 sub GetFacets { Link Here
619
        $facets = _get_facets_from_records( $rs );
619
        $facets = _get_facets_from_records( $rs );
620
    }
620
    }
621
621
622
    if ( C4::Context->interface eq 'opac' ) {
623
        for my $k ( keys %$facets ) {
624
            if ( $k eq 'itype' ) {
625
                my $itemtypes = Koha::ItemTypes->new;
626
                for my $fv ( keys %{ $facets->{$k} } ) {
627
                    my $itemtype = $itemtypes->find($fv);
628
                    if ( defined $itemtype && $itemtype->hideinopac ) {
629
                        delete $facets->{$k}->{$fv};
630
                    }
631
                }
632
            }
633
        }
634
    }
635
622
    return $facets;
636
    return $facets;
623
}
637
}
624
638
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (-1 / +4 lines)
Lines 476-481 sub _convert_facets { Link Here
476
        holdingbranch => $library_names,
476
        holdingbranch => $library_names,
477
        homebranch => $library_names
477
        homebranch => $library_names
478
    );
478
    );
479
480
    my @hidden_itemtypes = map { $_->itemtype } ( grep { $opac && $_->hideinopac } @itypes );
481
479
    my @facets;
482
    my @facets;
480
    $exp_facet //= '';
483
    $exp_facet //= '';
481
    while ( my ( $type, $data ) = each %$es ) {
484
    while ( my ( $type, $data ) = each %$es ) {
Lines 495-500 sub _convert_facets { Link Here
495
            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
498
            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
496
            my $c = $term->{doc_count};
499
            my $c = $term->{doc_count};
497
            my $label;
500
            my $label;
501
            next if $type eq 'itype' && grep { $_ eq $t } @hidden_itemtypes;
498
            if ( exists( $special{$type} ) ) {
502
            if ( exists( $special{$type} ) ) {
499
                $label = $special{$type}->{$t} // $t;
503
                $label = $special{$type}->{$t} // $t;
500
            }
504
            }
501
- 

Return to bug 14007