From acdca314e67ba791ba6e1c9ea9dc91f24a677df7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 4 Mar 2026 12:26:53 +0100 Subject: [PATCH] Bug 41989: Rename $lang in addbooks I was navigating thought Koha and once I hit addbook the UI switched to French (my browser set Accept-Language en-GB,fr;q=0.9,es;q=0.8,en;q=0.7) I don't have the cookie lang. No idea what happened but I think the "$lang" variable in the controller might conflict with... a global $lang? It actually switched to French then Italian and German... --- cataloguing/addbooks.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl index 9c8c3e4ffbf..5c3d48a8ffa 100755 --- a/cataloguing/addbooks.pl +++ b/cataloguing/addbooks.pl @@ -43,7 +43,6 @@ my $query = $input->param('q'); my @value = $input->multi_param('value'); my $page = $input->param('page') || 1; my $results_per_page = 20; -my $lang = C4::Languages::getlanguage($input); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -60,12 +59,15 @@ if ($query) { # build query my @operands = $query; + my $current_lang = C4::Languages::getlanguage($input); my $builtquery; my $query_cgi; my $builder = Koha::SearchEngine::QueryBuilder->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); my $searcher = Koha::SearchEngine::Search->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } ); - ( undef, $builtquery, undef, $query_cgi, undef, undef, undef, undef, undef, undef ) = - $builder->build_query_compat( undef, \@operands, undef, undef, undef, 0, $lang, { weighted_fields => 1 } ); + ( undef, $builtquery, undef, $query_cgi, undef, undef, undef, undef, undef, undef ) = $builder->build_query_compat( + undef, \@operands, undef, undef, undef, 0, $current_lang, + { weighted_fields => 1 } + ); $template->param( search_query => $builtquery ) if C4::Context->preference('DumpSearchQueryTemplate'); -- 2.43.0