Remove unused variable $opac from C4/Search.pm getRecords subroutine.
It appears Bug 17248 made C4::Search::getRecords() parameter $opac unused and causes location and collection facets to prefer OPAC description over intranet one in all interfaces, including intranet itself.
(In reply to Lari Taskula from comment #1) Renamed bug title to match issue described in comment #1
Created attachment 94812 [details] [review] Bug 23912: Get correct authorised value description for location and ccode facets in intranet Bug 17248 made C4::Search::getRecords() parameter $opac unused and causes location and collection facets to prefer OPAC description over intranet one in all interfaces, including intranet itself. This patch restores the functionality provided by $opac parameter. To reproduce: 1. Go to /cgi-bin/koha/admin/authorised_values.pl?searchfield=LOC and change both Description and Description (OPAC) of one row to be different 2. Do the same for /cgi-bin/koha/admin/authorised_values.pl?searchfield=CCODE 3. In intranet, search a record and make sure you are able to see facets after performing the search (your search must return multiple records) 4. Add/edit an item of one of these biblios on your results screen 5. Give this item the location and collection code that you changed in steps 1&2 6. In intranet, perform the same search from step 3 again 7. Observe your location and collections facets show Description (OPAC) value from step 1 and 2 instead of Description. To test: 1. Apply patch 2. Try to reproduce the bug again in intranet 3. Observe you will now see Description value instead of Description (OPAC) 4. prove t/db_dependent/Search.t Sponsored-by: Koha-Suomi Oy
Created attachment 94813 [details] [review] Bug 23912: Use C4::Context->interface instead of passing $opac Since most of Koha's codebase using getRecords() is not passing $opac into the subroutine (the only exception being opac-search.pl and search.pl), remove parameter $opac from list of subroutine parameters and replace the functionality with C4::Context->interface. To test: 1. See test plan of the previous patch Sponsored-by: Koha-Suomi Oy
Change for LOC is a regression from bug 17248 (>= 16.11). CCODE is coming from bug 18322 (>= 18.11).
(In reply to Lari Taskula from comment #4) > Created attachment 94813 [details] [review] [review] > Bug 23912: Use C4::Context->interface instead of passing $opac Also, maybe we should move this one to its own bug report (more a code improvement than a bug fix). It seems that we could (should?) replace the first parameter of searchResults at the same time ( { interface => 'opac' } )
I think it needs review to use code like in Bug 26323. And also : Why is there in C4::Search::getRecords my $av = Koha::AuthorisedValues->search({ category => 'CCODE', authorised_value => $one_facet }); When the description is fetched in template : [% IF facets_loo.type_label_CollectionCodes %][% SET facet.facet_label_value = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => facet.facet_label_value, opac =>1 ) || facet.facet_label_value %][% END %] Shouldn't we better add code for location facet that is like for ccode ? And remove AV manipulation from C4::Search.
up
(In reply to Fridolin Somers from comment #8) > up Thanks! I'm currently not able to contribute to this Bug and probably will not be in the near future, so feel free to take over this Bug.
I'll reclassify as bug, as we should show the intranet descriptons in the intranet and the OPAC descriptions in the OPAC. OPAC description in intranet is a bug and also sounds like a regression (comment#1