diff --git a/C4/Koha.pm b/C4/Koha.pm index f19a017c19..4f386e469d 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -760,6 +760,12 @@ sub getFacets { tags => [ qw/ 440a 490a / ], sep => ', ', }, + { + idx => 'itype', + label => 'ItemTypes', + tags => [ qw/ 952y 942c / ], + sep => ', ', + }, ]; my $library_facet; $library_facet = { diff --git a/C4/Search.pm b/C4/Search.pm index ee7d8d9df9..4f616619d1 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -287,7 +287,7 @@ sub SimpleSearch { ( undef, $results_hashref, \@facets_loop ) = getRecords ( $koha_query, $simple_query, $sort_by_ref, $servers_ref, - $results_per_page, $offset, $expanded_facet, $branches, + $results_per_page, $offset, $expanded_facet, $branches,$itemtypes, $query_type, $scan ); @@ -301,7 +301,7 @@ See verbse embedded documentation. sub getRecords { my ( $koha_query, $simple_query, $sort_by_ref, $servers_ref, - $results_per_page, $offset, $expanded_facet, $branches, + $results_per_page, $offset, $expanded_facet, $branches,$itemtypes, $query_type, $scan ) = @_; @@ -555,6 +555,17 @@ sub getRecords { $facet_label_value = "*"; } } + # if it's a itemtype, label by the name, not the code, + if ( $link_value =~ /itype/ ) { + if (defined $itemtypes + && ref($itemtypes) eq "HASH" + && defined $itemtypes->{$one_facet} + && ref ($itemtypes->{$one_facet}) eq "HASH") + { + $facet_label_value = + $itemtypes->{$one_facet}->{'description'}; + } + } # but we're down with the whole label being in the link's title. push @this_facets_array, { diff --git a/catalogue/search.pl b/catalogue/search.pl index 0052f664c5..2171df06d6 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -529,7 +529,7 @@ if (C4::Context->preference('NoZebra')) { }; } else { eval { - ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); + ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan); }; } # This sorts the facets into alphabetical order diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc index e74bced1b5..5cf6a7f61c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc @@ -15,6 +15,7 @@ [% IF ( facets_loo.type_label_Topics ) %]Topics[% END %] [% IF ( facets_loo.type_label_Places ) %]Places[% END %] [% IF ( facets_loo.type_label_Series ) %]Series[% END %] +[% IF ( facets_loo.type_label_ItemTypes ) %]Item types[% END %] [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]