Bugzilla – Attachment 94812 Details for
Bug 23912
Get correct authorised values for location and collections facets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23912: Get correct authorised value description for location and ccode facets in intranet
Bug-23912-Get-correct-authorised-value-description.patch (text/plain), 4.36 KB, created by
Lari Taskula
on 2019-10-28 14:59:30 UTC
(
hide
)
Description:
Bug 23912: Get correct authorised value description for location and ccode facets in intranet
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2019-10-28 14:59:30 UTC
Size:
4.36 KB
patch
obsolete
>From 9a8512227afa88b0a71f4032cb3ea8d59ce3aaf9 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Mon, 28 Oct 2019 14:05:33 +0000 >Subject: [PATCH] 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 >--- > C4/Search.pm | 21 ++++++++++++++++----- > catalogue/search.pl | 2 +- > 2 files changed, 17 insertions(+), 6 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 08f608648b..8ae291a898 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -571,20 +571,31 @@ sub getRecords { > } > } > >- # also, if it's a location code, use the name instead of the code >+ my $av; >+ # 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 : ''; >+ $av = Koha::AuthorisedValues->search({ category => 'LOC', authorised_value => $one_facet }); > } > > # also, if it's a collection code, use the name instead of the code > if ( $link_value =~ /ccode/ ) { > # TODO Retrieve all authorised values at once, instead of 1 query per entry >- my $av = Koha::AuthorisedValues->search({ category => 'CCODE', authorised_value => $one_facet }); >- $facet_label_value = $av->count ? $av->next->opac_description : ''; >+ $av = Koha::AuthorisedValues->search({ category => 'CCODE', authorised_value => $one_facet }); > } > >+ if ($opac) { >+ $facet_label_value = $av->next->opac_description if $av && $av->count; >+ } else { >+ $av = $av->next if $av && $av->count; >+ if ($av) { >+ my $lib = $av->lib; >+ $facet_label_value = $lib ? $lib : $av->lib_opac; >+ } >+ } >+ >+ $facet_label_value ||= ''; >+ > # 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 e1e9e85a3a..a58f837980 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -539,7 +539,7 @@ eval { > ( $error, $results_hashref, $facets ) = $searcher->search_compat( > $query, $simple_query, \@sort_by, \@servers, > $results_per_page, $offset, undef, $itemtypes, >- $query_type, $scan >+ $query_type, $scan, 0 > ); > }; > >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23912
: 94812 |
94813