Bugzilla – Attachment 176213 Details for
Bug 38846
Function getLanguages is called unnecessarily for search result pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38846: Only call getLanguages for advanced search pages
Bug-38846-Only-call-getLanguages-for-advanced-sear.patch (text/plain), 2.80 KB, created by
David Cook
on 2025-01-08 00:40:50 UTC
(
hide
)
Description:
Bug 38846: Only call getLanguages for advanced search pages
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-01-08 00:40:50 UTC
Size:
2.80 KB
patch
obsolete
>From d8d4e73a3137598fc917a212e56fd1c057b2ef05 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Wed, 8 Jan 2025 00:14:46 +0000 >Subject: [PATCH] Bug 38846: Only call getLanguages for advanced search pages > >This change makes it so that C4::Languages::getLanguages is only >called for the advanced search pages and not the search result pages >where the output is not used. > >Test plan: >0. Apply the patch and koha-plack --restart kohadev >1. Go to http://localhost:8081/cgi-bin/koha/catalogue/search.pl?expanded_options=1 >2. Note that the "Language" and "Language of original" dropdowns appear with language >options >3. Go to the following >http://localhost:8081/cgi-bin/koha/catalogue/search.pl?advsearch=1 >&idx=kw&q=test&sort_by=relevance >4. Note that the page loads normally > >5. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?expanded_options=1 >6. Note that the "Language" dropdown appears with language options >7. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1 >8. Note that the page loads normally >--- > catalogue/search.pl | 9 ++++++--- > opac/opac-search.pl | 9 ++++++--- > 2 files changed, 12 insertions(+), 6 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index ba97a75f1c..a19b022222 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -329,9 +329,12 @@ if ( $template_type eq 'advsearch' ) { > > $template->param(uc(C4::Context->preference("marcflavour")) =>1 ); > >- # load the language limits (for search) >- my $languages_limit_loop = getLanguages($lang, 1); >- $template->param(search_languages_loop => $languages_limit_loop,); >+ if ( $template_type && $template_type eq 'advsearch' ) { >+ >+ # load the language limits (for search) >+ my $languages_limit_loop = getLanguages( $lang, 1 ); >+ $template->param( search_languages_loop => $languages_limit_loop, ); >+ } > > # Expanded search options in advanced search: > # use the global setting by default, but let the user override it >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 49b0b467d0..54eabd8949 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -220,9 +220,12 @@ if ($cgi->cookie("search_path_code")) { > my @search_groups = Koha::Library::Groups->get_search_groups( { interface => 'opac' } )->as_list; > $template->param( search_groups => \@search_groups ); > >-# load the language limits (for search) >-my $languages_limit_loop = getLanguages($lang, 1); >-$template->param(search_languages_loop => $languages_limit_loop,); >+if ( $template_type && $template_type eq 'advsearch' ) { >+ >+ # load the language limits (for search) >+ my $languages_limit_loop = getLanguages( $lang, 1 ); >+ $template->param( search_languages_loop => $languages_limit_loop, ); >+} > > # load the Type stuff > my $itemtypes = GetItemTypesCategorized; >-- >2.39.5
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 38846
:
176213
|
176236