Lines 378-422
my @nolimits = map uri_unescape($_), $cgi->multi_param('nolimit');
Link Here
|
378 |
my %is_nolimit = map { $_ => 1 } @nolimits; |
378 |
my %is_nolimit = map { $_ => 1 } @nolimits; |
379 |
@limits = grep { not $is_nolimit{$_} } @limits; |
379 |
@limits = grep { not $is_nolimit{$_} } @limits; |
380 |
|
380 |
|
381 |
if ( $params->{'multibranchlimit'} ) { |
|
|
382 |
my $branchfield = C4::Context->preference('SearchLimitLibrary'); |
383 |
my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} ); |
384 |
my @branchcodes = map { $_->branchcode } $search_group->all_libraries; |
385 |
|
386 |
if (@branchcodes) { |
387 |
if ( $branchfield eq "homebranch" ) { |
388 |
push @limits, sprintf "(%s)", join " or ", map { 'homebranch: ' . $_ } @branchcodes; |
389 |
} |
390 |
elsif ( $branchfield eq "holdingbranch" ) { |
391 |
push @limits, sprintf "(%s)", join " or ", map { 'holdingbranch: ' . $_ } @branchcodes; |
392 |
} |
393 |
else { |
394 |
push @limits, sprintf "(%s or %s)", |
395 |
join( " or ", map { 'homebranch: ' . $_ } @branchcodes ), |
396 |
join( " or ", map { 'holdingbranch: ' . $_ } @branchcodes ); |
397 |
} |
398 |
} |
399 |
} |
400 |
|
401 |
for ( my $i=0; $i<@limits; $i++ ) { |
402 |
if ( $limits[$i] =~ /^branch:/ ) { |
403 |
my $branchfield = C4::Context->preference('SearchLimitLibrary'); |
404 |
if ( $branchfield eq "homebranch" ) { |
405 |
$limits[$i] =~ s/branch/homebranch/; |
406 |
} |
407 |
elsif ( $branchfield eq "holdingbranch" ) { |
408 |
$limits[$i] =~ s/branch/holdingbranch/; |
409 |
} |
410 |
else { |
411 |
my $homebranchlimit = $limits[$i]; |
412 |
my $holdingbranchlimit = $limits[$i]; |
413 |
$homebranchlimit =~ s/branch/homebranch/; |
414 |
$holdingbranchlimit =~ s/branch/holdingbranch/; |
415 |
$limits[$i] = "($homebranchlimit or $holdingbranchlimit)"; |
416 |
} |
417 |
} |
418 |
} |
419 |
|
420 |
my $available; |
381 |
my $available; |
421 |
foreach my $limit(@limits) { |
382 |
foreach my $limit(@limits) { |
422 |
if ($limit =~/available/) { |
383 |
if ($limit =~/available/) { |