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 |
- |
|
|