Bugzilla – Attachment 94813 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: Use C4::Context->interface instead of passing $opac
Bug-23912-Use-C4Context-interface-instead-of-passi.patch (text/plain), 3.63 KB, created by
Lari Taskula
on 2019-10-28 14:59:48 UTC
(
hide
)
Description:
Bug 23912: Use C4::Context->interface instead of passing $opac
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2019-10-28 14:59:48 UTC
Size:
3.63 KB
patch
obsolete
>From 1b3abc170ed4f1d3d9afabafb11702b35e2e8d31 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Mon, 28 Oct 2019 14:13:42 +0000 >Subject: [PATCH] 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 >--- > C4/Search.pm | 8 +++++--- > catalogue/search.pl | 2 +- > opac/opac-search.pl | 2 +- > 3 files changed, 7 insertions(+), 5 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 8ae291a898..850ec1ea37 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -313,7 +313,7 @@ sub SimpleSearch { > > $koha_query, $simple_query, $sort_by_ref, $servers_ref, > $results_per_page, $offset, $branches, $itemtypes, >- $query_type, $scan, $opac >+ $query_type, $scan > ); > > The all singing, all dancing, multi-server, asynchronous, scanning, >@@ -327,7 +327,7 @@ sub getRecords { > my ( > $koha_query, $simple_query, $sort_by_ref, $servers_ref, > $results_per_page, $offset, $branches, $itemtypes, >- $query_type, $scan, $opac >+ $query_type, $scan > ) = @_; > > my @servers = @$servers_ref; >@@ -343,6 +343,8 @@ sub getRecords { > # TODO simplify this structure ( { branchcode => $branchname } is enought) and remove this parameter > $branches ||= { map { $_->branchcode => { branchname => $_->branchname } } Koha::Libraries->search }; > >+ my $interface = C4::Context->interface; >+ > # Initialize variables for the faceted results objects > my $facets_counter = {}; > my $facets_info = {}; >@@ -584,7 +586,7 @@ sub getRecords { > $av = Koha::AuthorisedValues->search({ category => 'CCODE', authorised_value => $one_facet }); > } > >- if ($opac) { >+ if ($interface eq 'opac') { > $facet_label_value = $av->next->opac_description if $av && $av->count; > } else { > $av = $av->next if $av && $av->count; >diff --git a/catalogue/search.pl b/catalogue/search.pl >index a58f837980..e1e9e85a3a 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, 0 >+ $query_type, $scan > ); > }; > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index ea78ca0b23..c8d49cbd88 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -633,7 +633,7 @@ if ($tag) { > $pasarParams .= '&query_type=' . uri_escape_utf8($query_type) if ($query_type); > my $itemtypes_nocategory = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; > eval { >- ($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes_nocategory,$query_type,$scan,1); >+ ($error, $results_hashref, $facets) = $searcher->search_compat($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,undef,$itemtypes_nocategory,$query_type,$scan); > }; > } > >-- >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