From 030693740a5703eba4ca8ef44ef523fa340b5b42 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 May 2018 14:41:14 -0300 Subject: [PATCH] Bug 20838: (bug 16735 follow-up) Fix search by group of libraries In the last patches of bug 16735, we completely broke the feature! The limit is using library_groups.id instead of branches.branchcode. Test plan: Create a group of library with the search feature Search (OPAC and staff interfaces) using this limit => Without this patch you will see that the generated search query does not contain branchcodes => With this patch applied you will see the branchcodes --- catalogue/search.pl | 2 +- opac/opac-search.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 27b36b7802..6fc96d638f 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -399,7 +399,7 @@ my %is_nolimit = map { $_ => 1 } @nolimits; if($params->{'multibranchlimit'}) { my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); my @libraries = $search_group->all_libraries; - my $multibranch = '('.join( " or ", map { 'branch: ' . $_->id } @libraries ) .')'; + my $multibranch = '('.join( " or ", map { 'branch: ' . $_->branchcode } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index f89e521665..1d7615bc5c 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -493,7 +493,7 @@ if (@searchCategories > 0) { if($params->{'multibranchlimit'}) { my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); my @libraries = $search_group->all_libraries; - my $multibranch = '('.join( " or ", map { 'branch: ' . $_->id } @libraries ) .')'; + my $multibranch = '('.join( " or ", map { 'branch: ' . $_->branchcode } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } -- 2.11.0