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

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

Return to bug 10542