Re: [Koha] How to show description of authorized value in facet? SOLVED
Hi Marc 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. Yes indeed - and there may be many other adaptions in other files, depending on the needs of the library. In fact I think therefore many libraries do not really install the monthly updates - sometimes they even contain new bugs (so oldstable is preferred to stable), also it is most of the time very unclear if the publicly undocumented "security fixes" are relevant for the actual environment. Reading this list I often see some libraries which are years back with their versions for which of course no monthly updates exist at all. 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. Feel free to open such a bug report if you see a chance to get it into the 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 m...@adminkuhn.ch · W www.adminkuhn.ch ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Re: [Koha] How to show description of authorized value in facet? SOLVED
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 m...@adminkuhn.ch · W www.adminkuhn.ch ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
Re: [Koha] How to show description of authorized value in facet? SOLVED
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 m...@adminkuhn.ch · W www.adminkuhn.ch ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
[Koha] How to show description of authorized value in facet?
Hi 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? Best wishes: Michael ___ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha