Bug 20838: (bug 16735 follow-up) Fix search by group of libraries
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 30 May 2018 17:41:14 +0000 (14:41 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 4 Jun 2018 17:40:36 +0000 (13:40 -0400)
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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

catalogue/search.pl
opac/opac-search.pl

index 27b36b7..6fc96d6 100755 (executable)
@@ -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  '()');
 }
 
index f89e521..1d7615b 100755 (executable)
@@ -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  '()');
 }