Bug 12478: facets - Display description instead of code for locations

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2015-10-05 12:50:52 +01:00 committed by Brendan Gallagher
parent 446cf8381d
commit 7a9d8d6b29
1 changed files with 6 additions and 1 deletions

View File

@ -39,7 +39,9 @@ Koha::SearchEngine::ElasticSearch::Search - search functions for Elasticsearch
=cut
use base qw(Koha::ElasticSearch);
use C4::Context;
use Koha::ItemTypes;
use Koha::AuthorisedValues;
use Koha::SearchEngine::QueryBuilder;
use Catmandu::Store::ElasticSearch;
@ -400,8 +402,11 @@ sub _convert_facets {
# We also have some special cases, e.g. itypes that need to show the
# value rather than the code.
my @itypes = Koha::ItemTypes->search;
my @locations = Koha::AuthorisedValues->search( { category => 'LOC' } );
my $opac = C4::Context->interface eq 'opac' ;
my %special = (
itype => { map { $_->itemtype => $_->description } @itypes },
itype => { map { $_->itemtype => $_->description } @itypes },
location => { map { $_->authorised_value => ( $opac ? ( $_->lib_opac || $_->lib ) : $_->lib ) } @locations },
);
my @res;
$exp_facet //= '';