@@ -, +, @@ --- .../Elasticsearch/QueryBuilder.pm | 10 ---------- .../data/mysql/atomicupdate/bug_35138.pl | 19 +++++++++++++++++-- .../modules/admin/preferences/searching.pref | 1 + 3 files changed, 18 insertions(+), 12 deletions(-) --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -232,16 +232,6 @@ sub build_query { $res->{aggregations}->{$name} = { terms => { field => "${name}__facet" , size => $size } }; }; - # FIXME We need a way to show/hide the facet individually - #my $display_library_facets = C4::Context->preference('DisplayLibraryFacets'); - #if ( $display_library_facets eq 'both' - # or $display_library_facets eq 'home' ) { - # $res->{aggregations}{homebranch} = { terms => { field => "homebranch__facet", size => $size } }; - #} - #if ( $display_library_facets eq 'both' - # or $display_library_facets eq 'holding' ) { - # $res->{aggregations}{holdingbranch} = { terms => { field => "holdingbranch__facet", size => $size } }; - #} return $res; } --- a/installer/data/mysql/atomicupdate/bug_35138.pl +++ a/installer/data/mysql/atomicupdate/bug_35138.pl @@ -27,7 +27,22 @@ return { } $sth->execute( 'Collections', 'ccode', 'collection-code'); - $sth->execute( 'Holding libraries', 'holdingbranch', 'holdinglibrary'); - $sth->execute( 'Home libraries', 'homebranch', 'homelibrary'); + + # Deal with DisplayLibraryFacets + my ($DisplayLibraryFacets) = $dbh->selectrow_array(q{ + SELECT value FROM systempreferences WHERE variable='DisplayLibraryFacets' + }); + my ($homebranch, $holdingbranch); + if ( $DisplayLibraryFacets eq 'both' ) { + $homebranch = 1; + $holdingbranch = 1; + } elsif ( $DisplayLibraryFacets eq 'holding' ) { + $holdingbranch = 1; + } elsif ( $DisplayLibraryFacets eq 'home' ) { + $homebranch = 1; + } + $sth->execute( 'Holding libraries', 'holdingbranch', 'holdinglibrary') if $holdingbranch; + $sth->execute( 'Home libraries', 'homebranch', 'homelibrary') if $homebranch; + }, }; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -283,6 +283,7 @@ Searching: home: "home library" holding: "holding library" both: "both home and holding library" + - (Zebra only). - - Truncate facets length to - pref: FacetLabelTruncationLength --