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