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

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

Return to bug 14007