Lines 420-440
my @nolimits = map uri_unescape($_), $cgi->multi_param('nolimit');
Link Here
|
420 |
my %is_nolimit = map { $_ => 1 } @nolimits; |
420 |
my %is_nolimit = map { $_ => 1 } @nolimits; |
421 |
@limits = grep { not $is_nolimit{$_} } @limits; |
421 |
@limits = grep { not $is_nolimit{$_} } @limits; |
422 |
|
422 |
|
423 |
my $branchfield = C4::Context->preference('AdvancedSearchBranchFieldToUse'); |
423 |
if ( $params->{'multibranchlimit'} ) { |
424 |
|
424 |
my $branchfield = C4::Context->preference('AdvancedSearchBranchFieldToUse'); |
425 |
if($params->{'multibranchlimit'}) { |
|
|
426 |
my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); |
425 |
my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); |
427 |
my @libraries = $search_group->all_libraries; |
426 |
my @branchcodes = map { $_->branchcode } $search_group->all_libraries; |
428 |
|
427 |
|
429 |
if ( $branchfield eq "homebranch") { |
428 |
if (@branchcodes) { |
430 |
my $multihomebranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode } @libraries ) .')'; |
429 |
if ( $branchfield eq "homebranch" ) { |
431 |
push @limits, $multihomebranch if ( $multihomebranch ne '()'); |
430 |
push @limits, sprintf "(%s)", join " or ", map { 'homebranch: ' . $_ } @branchcodes; |
432 |
} elsif ( $branchfield eq "holdingbranch") { |
431 |
} |
433 |
my $multiholdingbranch = '('.join( " OR ", map { 'holdingbranch: ' . $_->branchcode } @libraries ) .')'; |
432 |
elsif ( $branchfield eq "holdingbranch" ) { |
434 |
push @limits, $multiholdingbranch if ( $multiholdingbranch ne '()'); |
433 |
push @limits, sprintf "(%s)", join " or ", map { 'holdingbranch: ' . $_ } @branchcodes; |
435 |
} else { |
434 |
} |
436 |
my $multihomeandholdingbranch = '('.join( " OR ", map { 'homebranch: ' . $_->branchcode, 'holdingbranch: ' . $_->branchcode} @libraries ) .')'; |
435 |
else { |
437 |
push @limits, $multihomeandholdingbranch if ($multihomeandholdingbranch ne '()'); |
436 |
push @limits, sprintf "(%s or %s)", |
|
|
437 |
join( " or ", map { 'homebranch: ' . $_ } @branchcodes ), |
438 |
join( " or ", map { 'holdingbranch: ' . $_ } @branchcodes ); |
439 |
} |
438 |
} |
440 |
} |
439 |
} |
441 |
} |
440 |
|
442 |
|