Lines 379-399
my @nolimits = map uri_unescape($_), $cgi->multi_param('nolimit');
Link Here
|
379 |
my %is_nolimit = map { $_ => 1 } @nolimits; |
379 |
my %is_nolimit = map { $_ => 1 } @nolimits; |
380 |
@limits = grep { not $is_nolimit{$_} } @limits; |
380 |
@limits = grep { not $is_nolimit{$_} } @limits; |
381 |
|
381 |
|
382 |
my $branchfield = C4::Context->preference('AdvancedSearchBranchFieldToUse'); |
382 |
if ( $params->{'multibranchlimit'} ) { |
383 |
|
383 |
my $branchfield = C4::Context->preference('AdvancedSearchBranchFieldToUse'); |
384 |
if($params->{'multibranchlimit'}) { |
|
|
385 |
my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); |
384 |
my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); |
386 |
my @libraries = $search_group->all_libraries; |
385 |
my @branchcodes = map { $_->branchcode } $search_group->all_libraries; |
387 |
|
386 |
|
388 |
if ( $branchfield eq "homebranch") { |
387 |
if (@branchcodes) { |
389 |
my $multihomebranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; |
388 |
if ( $branchfield eq "homebranch" ) { |
390 |
push @limits, $multihomebranch if ( $multihomebranch ne '()'); |
389 |
push @limits, sprintf "(%s)", join " or ", map { 'homebranch: ' . $_ } @branchcodes; |
391 |
} elsif ( $branchfield eq "holdingbranch") { |
390 |
} |
392 |
my $multiholdingbranch = '('.join( " OR ", map { 'holdingbranch: ' . $_->branchcode } @libraries ) .')'; |
391 |
elsif ( $branchfield eq "holdingbranch" ) { |
393 |
push @limits, $multiholdingbranch if ( $multiholdingbranch ne '()'); |
392 |
push @limits, sprintf "(%s)", join " or ", map { 'holdingbranch: ' . $_ } @branchcodes; |
394 |
} else { |
393 |
} |
395 |
my $multihomeandholdingbranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode, 'holdingbranch: ' . $_->branchcode} @libraries ) .')'; |
394 |
else { |
396 |
push @limits, $multihomeandholdingbranch if ($multihomeandholdingbranch ne '()'); |
395 |
push @limits, sprintf "(%s or %s)", |
|
|
396 |
join( " or ", map { 'homebranch: ' . $_ } @branchcodes ), |
397 |
join( " or ", map { 'holdingbranch: ' . $_ } @branchcodes ); |
398 |
} |
397 |
} |
399 |
} |
398 |
} |
400 |
} |
399 |
|
401 |
|