From 574d309d49b5166aa0c55702c220803d12816bd5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 22 Mar 2024 09:53:47 +0100 Subject: [PATCH] Bug 35138: Mark DisplayLibraryFacets as zebra only We can know add/remove homelibrary and holdinglibray from the config page, this syspref is no longer needed for ES Sponsored-by: The Research University in the Helmholtz Association (KIT) Signed-off-by: Clemens Tubach --- .../Elasticsearch/QueryBuilder.pm | 10 ---------- .../data/mysql/atomicupdate/bug_35138.pl | 19 +++++++++++++++++-- .../modules/admin/preferences/searching.pref | 1 + 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index e91f02f91d..c8642a4259 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/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; } diff --git a/installer/data/mysql/atomicupdate/bug_35138.pl b/installer/data/mysql/atomicupdate/bug_35138.pl index 14b48246fa..224a9b0aca 100755 --- a/installer/data/mysql/atomicupdate/bug_35138.pl +++ b/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; + }, }; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref index 86b9f54ae1..d8888e7296 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -278,6 +278,7 @@ Searching: home: "home library" holding: "holding library" both: "both home and holding library" + - (Zebra only). - - Truncate facets length to - pref: FacetLabelTruncationLength -- 2.30.2