From 7a85353be014ba36c308b7417c685c0d7aa2c820 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 Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- .../Elasticsearch/QueryBuilder.pm | 11 ----------- .../data/mysql/atomicupdate/bug_35138.pl | 19 +++++++++++++++++-- .../modules/admin/preferences/searching.pref | 1 + 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 5c7c9b0d61..ac161e50fd 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -233,17 +233,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 } }; - #} $res = _rebuild_to_es_advanced_query($res) if @$es_advanced_searches ; 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 e0db164b91..da202d7e1e 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 @@ -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 -- 2.39.5