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