View | Details | Raw Unified | Return to bug 10542
Collapse All | Expand All

(-)a/opac/opac-search.pl (-10 / +28 lines)
Lines 445-450 my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_ Link Here
445
445
446
my @results;
446
my @results;
447
447
448
# Add OPAC suppression - requires at least one item indexed with Suppress
449
if (C4::Context->preference('UseQueryParser')) {
450
    if (C4::Context->preference('OpacSuppression')) {
451
        # OPAC suppression by IP address
452
        if (C4::Context->preference('OpacSuppressionByIPRange')) {
453
            my $IPAddress = $ENV{'REMOTE_ADDR'};
454
            my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
455
            if ($IPAddress !~ /^$IPRange/)  {
456
                $query = "$query -suppress:1";
457
            }
458
        }
459
        else {
460
            $query = "$query -suppress:1";
461
        }
462
    }
463
}
464
448
## I. BUILD THE QUERY
465
## I. BUILD THE QUERY
449
( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by, 0, $lang);
466
( $error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by, 0, $lang);
450
467
Lines 472-489 my @limit_inputs = $limit_cgi ? _input_cgi_parse($limit_cgi) : (); Link Here
472
#}
489
#}
473
#
490
#
474
# add OPAC suppression - requires at least one item indexed with Suppress
491
# add OPAC suppression - requires at least one item indexed with Suppress
475
if (C4::Context->preference('OpacSuppression')) {
492
unless ( C4::Context->preference('UseQueryParser') ) {
476
    # OPAC suppression by IP address
493
    if (C4::Context->preference('OpacSuppression')) {
477
    if (C4::Context->preference('OpacSuppressionByIPRange')) {
494
        # OPAC suppression by IP address
478
        my $IPAddress = $ENV{'REMOTE_ADDR'};
495
        if (C4::Context->preference('OpacSuppressionByIPRange')) {
479
        my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
496
            my $IPAddress = $ENV{'REMOTE_ADDR'};
480
        if ($IPAddress !~ /^$IPRange/)  {
497
            my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
498
            if ($IPAddress !~ /^$IPRange/)  {
499
                $query = "($query) not Suppress=1";
500
            }
501
        }
502
        else {
481
            $query = "($query) not Suppress=1";
503
            $query = "($query) not Suppress=1";
482
        }
504
        }
483
    }
505
    }
484
    else {
485
        $query = "($query) not Suppress=1";
486
    }
487
}
506
}
488
507
489
$template->param ( LIMIT_INPUTS => \@limit_inputs );
508
$template->param ( LIMIT_INPUTS => \@limit_inputs );
490
- 

Return to bug 10542