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

(-)a/opac/opac-ISBDdetail.pl (+27 lines)
Lines 76-81 if( !$biblio ) { Link Here
76
    exit;
76
    exit;
77
}
77
}
78
78
79
# If record should be suppressed, handle it early
80
if ( C4::Context->preference('OpacSuppression') ) {
81
82
    # redirect to opac-blocked info page or 404?
83
    my $redirect_url;
84
    if ( C4::Context->preference("OpacSuppressionRedirect") ) {
85
        $redirect_url = "/cgi-bin/koha/opac-blocked.pl";
86
    } else {
87
        $redirect_url = "/cgi-bin/koha/errors/404.pl";
88
    }
89
    if ( $biblio->opac_suppressed() ) {
90
91
        # if OPAC suppression by IP address
92
        if ( C4::Context->preference('OpacSuppressionByIPRange') ) {
93
            my $IPAddress = $ENV{'REMOTE_ADDR'};
94
            my $IPRange   = C4::Context->preference('OpacSuppressionByIPRange');
95
            if ( $IPAddress !~ /^$IPRange/ ) {
96
                print $query->redirect($redirect_url);
97
                exit;
98
            }
99
        } else {
100
            print $query->redirect($redirect_url);
101
            exit;
102
        }
103
    }
104
}
105
79
#open template
106
#open template
80
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
107
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
81
    {
108
    {
(-)a/opac/opac-MARCdetail.pl (+27 lines)
Lines 99-104 if ( ! $record ) { Link Here
99
    exit;
99
    exit;
100
}
100
}
101
101
102
# If record should be suppressed, handle it early
103
if ( C4::Context->preference('OpacSuppression') ) {
104
105
    # redirect to opac-blocked info page or 404?
106
    my $redirect_url;
107
    if ( C4::Context->preference("OpacSuppressionRedirect") ) {
108
        $redirect_url = "/cgi-bin/koha/opac-blocked.pl";
109
    } else {
110
        $redirect_url = "/cgi-bin/koha/errors/404.pl";
111
    }
112
    if ( $biblio->opac_suppressed() ) {
113
114
        # if OPAC suppression by IP address
115
        if ( C4::Context->preference('OpacSuppressionByIPRange') ) {
116
            my $IPAddress = $ENV{'REMOTE_ADDR'};
117
            my $IPRange   = C4::Context->preference('OpacSuppressionByIPRange');
118
            if ( $IPAddress !~ /^$IPRange/ ) {
119
                print $query->redirect($redirect_url);
120
                exit;
121
            }
122
        } else {
123
            print $query->redirect($redirect_url);
124
            exit;
125
        }
126
    }
127
}
128
102
unless ( $patron and $patron->category->override_hidden_items ) {
129
unless ( $patron and $patron->category->override_hidden_items ) {
103
    # only skip this check if there's a logged in user
130
    # only skip this check if there's a logged in user
104
    # and its category overrides OpacHiddenItems
131
    # and its category overrides OpacHiddenItems
(-)a/opac/opac-detail.pl (-32 / +27 lines)
Lines 112-117 unless ( $biblio && $record ) { Link Here
112
    exit;
112
    exit;
113
}
113
}
114
114
115
# If record should be suppressed, handle it early
116
if ( C4::Context->preference('OpacSuppression') ) {
117
118
    # redirect to opac-blocked info page or 404?
119
    my $redirect_url;
120
    if ( C4::Context->preference("OpacSuppressionRedirect") ) {
121
        $redirect_url = "/cgi-bin/koha/opac-blocked.pl";
122
    } else {
123
        $redirect_url = "/cgi-bin/koha/errors/404.pl";
124
    }
125
    if ( $biblio->opac_suppressed() ) {
126
127
        # if OPAC suppression by IP address
128
        if ( C4::Context->preference('OpacSuppressionByIPRange') ) {
129
            my $IPAddress = $ENV{'REMOTE_ADDR'};
130
            my $IPRange   = C4::Context->preference('OpacSuppressionByIPRange');
131
            if ( $IPAddress !~ /^$IPRange/ ) {
132
                print $query->redirect($redirect_url);
133
                exit;
134
            }
135
        } else {
136
            print $query->redirect($redirect_url);
137
            exit;
138
        }
139
    }
140
}
141
115
my $items = $biblio->items->search_ordered;
142
my $items = $biblio->items->search_ordered;
116
if ($specific_item) {
143
if ($specific_item) {
117
    $items = $items->search( { itemnumber => scalar $query->param('itemnumber') } );
144
    $items = $items->search( { itemnumber => scalar $query->param('itemnumber') } );
Lines 140-176 my $record_processor = Koha::RecordProcessor->new({ Link Here
140
});
167
});
141
$record_processor->process($record);
168
$record_processor->process($record);
142
169
143
# redirect if opacsuppression is enabled and biblio is suppressed
144
if (C4::Context->preference('OpacSuppression')) {
145
    # FIXME hardcoded; the suppression flag ought to be materialized
146
    # as a column on biblio or the like
147
    my $opacsuppressionfield = '942';
148
    my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield);
149
    # redirect to opac-blocked info page or 404?
150
    my $opacsuppressionredirect;
151
    if ( C4::Context->preference("OpacSuppressionRedirect") ) {
152
        $opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl";
153
    } else {
154
        $opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl";
155
    }
156
    if ( $opacsuppressionfieldvalue &&
157
         $opacsuppressionfieldvalue->subfield("n") &&
158
         $opacsuppressionfieldvalue->subfield("n") == 1) {
159
        # if OPAC suppression by IP address
160
        if (C4::Context->preference('OpacSuppressionByIPRange')) {
161
            my $IPAddress = $ENV{'REMOTE_ADDR'};
162
            my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
163
            if ($IPAddress !~ /^$IPRange/)  {
164
                print $query->redirect($opacsuppressionredirect);
165
                exit;
166
            }
167
        } else {
168
            print $query->redirect($opacsuppressionredirect);
169
            exit;
170
        }
171
    }
172
}
173
174
$template->param(
170
$template->param(
175
    biblio => $biblio
171
    biblio => $biblio
176
);
172
);
177
- 

Return to bug 28478