From 7c0608cd6105b3d68f36cb51d9bc3fc63c5a3adb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 20 Jan 2016 11:22:07 +0000 Subject: [PATCH] [SIGNED-OFF] Bug 15629: Koha::Libraries - Remove GetBranchesInCategory (2) Content-Type: text/plain; charset="utf-8" C4::Branch::GetBranchesInCategory can be replaced with Koha::LibraryCategory->libraries Test plan: 1/ Define some 1+ group of libraries with 1+ libraries each 2/ Go on the advanced search (OPAC and Staff) and select a group of libraries 3/ The result should be consistent and only include record from these libraries Signed-off-by: Owen Leonard --- catalogue/search.pl | 4 +++- opac/opac-search.pl | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index 25b9855..dbc12d2 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -423,7 +423,9 @@ my %is_nolimit = map { $_ => 1 } @nolimits; @limits = grep { not $is_nolimit{$_} } @limits; if($params->{'multibranchlimit'}) { - my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')'; + my $library_category = Koha::LibraryCategories->find( $params->{multibranchlimit} ); + my @libraries = $library_category->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 8157e7d..4a865da 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -480,7 +480,9 @@ if (@searchCategories > 0) { @limits = map { uri_unescape($_) } @limits; if($params->{'multibranchlimit'}) { - my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')'; + my $library_category = Koha::LibraryCategories->find( $params->{multibranchlimit} ); + my @libraries = $library_category->libraries; + my $multibranch = '('.join( " or ", map { 'branch: ' . $_->branchcode } @libraries ) .')'; push @limits, $multibranch if ($multibranch ne '()'); } -- 2.1.4