[Koha] How to show description of authorized value in facet? SOLVED
Marc Véron
veron at veron.ch
Fri Apr 7 18:12:59 NZST 2017
Hi Michael,
Thanks for sharing your findings about resolving an authorised value
while using MARC field 385 $a (Audience term) as a facet.
As you write, such code changes will have to be maintained with every
update. Since there are monthly releases, including bug fixes and
sometimes security fixes, maintaining such code can be a bit cumbersome.
IMO it would be a good idea to open a Bug (enhancement) in
https://bugs.koha-community.org
That would be a good starting point to have a more generic solution
inside the Koha code base.
Kind regards
Marc
www.koha-support.ch
Am 07.04.2017 um 00:12 schrieb Michael Kuhn:
> Hi
>
> Today I wrote:
>
>> Environment: Debian GNU/Linux 8 with Koha 16.11.04 (package
installation)
>>
>> Our Koha catalogue contains MARC field 385 $a with content e. g. "KG",
>> linked to category "Lesekategorie" containing authorized values for the
>> target audience, e. g. value "KG" (description for staff client and OPAC
>> is: "Kindergarten"). Instead of "KG" the OPAC shows "Kindergarten" as
>> expected.
>>
>> Now I have recently added a new facet for MARC field 385 $a and the
>> facet does show - only instead of the description ("Kindergarten"), the
>> facet shows the authorized value "KG". How can it be achieved to show
>> the description in the facet?
>>
>> As I see it is actually possible to show the description because the
>> authorized values for standard category "LOC" are properly showing the
>> descriptions. I tried to find out how this works in file
>> "opac-facets.inc" but without success. Can anyone please give me a
hint?
>
> For the record:
>
> Jens Weber found the following code in file
"/usr/share/koha/lib/C4/Search.pm":
>
> # also, if it's a location code, use the name instead of the code
> if ( $link_value =~ /location/ ) {
> # TODO Retrieve all authorised values at once, instead of 1 query
per entry
> my $av = Koha::AuthorisedValues->search({ category => 'LOC',
authorised_value => $one_facet });
> $facet_label_value = $av->count ? $av->next->opac_description : '';
> }
>
> I copied this section and adapted it as follows:
>
> # also, if it's a lesekategorie code, use the name instead of the code
> if ( $link_value =~ /lesekategorie/ ) {
> my $av = Koha::AuthorisedValues->search({ category =>
'Lesekategorie', authorised_value => $one_facet });
> $facet_label_value = $av->count ? $av->next->opac_description : '';
> }
>
> After a restart of Koha (including Plack) now the created facet
actually shows the description ("Kindergarten") instead of the
authorized value "KG". Great!
>
> Of course this change will have to be reconfigured with every update
but I guess it makes no sense to include this in the official Koha code...
>
> Best wishes: Michael
> --
> Geschäftsführer · Diplombibliothekar BBS, Informatiker eidg. Fachausweis
> Admin Kuhn GmbH · Pappelstrasse 20 · 4123 Allschwil · Schweiz
> T 0041 (0)61 261 55 61 · E mik at adminkuhn.ch · W www.adminkuhn.ch
More information about the Koha
mailing list