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 $metadata_extractor = $biblio->metadata_extractor; |
142 |
my $metadata_extractor = $biblio->metadata_extractor; |
116 |
|
143 |
|
117 |
my $items = $biblio->items->search_ordered; |
144 |
my $items = $biblio->items->search_ordered; |
Lines 142-178
my $record_processor = Koha::RecordProcessor->new({
Link Here
|
142 |
}); |
169 |
}); |
143 |
$record_processor->process($record); |
170 |
$record_processor->process($record); |
144 |
|
171 |
|
145 |
# redirect if opacsuppression is enabled and biblio is suppressed |
|
|
146 |
if (C4::Context->preference('OpacSuppression')) { |
147 |
# FIXME hardcoded; the suppression flag ought to be materialized |
148 |
# as a column on biblio or the like |
149 |
my $opacsuppressionfield = '942'; |
150 |
my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield); |
151 |
# redirect to opac-blocked info page or 404? |
152 |
my $opacsuppressionredirect; |
153 |
if ( C4::Context->preference("OpacSuppressionRedirect") ) { |
154 |
$opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl"; |
155 |
} else { |
156 |
$opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl"; |
157 |
} |
158 |
if ( $opacsuppressionfieldvalue && |
159 |
$opacsuppressionfieldvalue->subfield("n") && |
160 |
$opacsuppressionfieldvalue->subfield("n") == 1) { |
161 |
# if OPAC suppression by IP address |
162 |
if (C4::Context->preference('OpacSuppressionByIPRange')) { |
163 |
my $IPAddress = $ENV{'REMOTE_ADDR'}; |
164 |
my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); |
165 |
if ($IPAddress !~ /^$IPRange/) { |
166 |
print $query->redirect($opacsuppressionredirect); |
167 |
exit; |
168 |
} |
169 |
} else { |
170 |
print $query->redirect($opacsuppressionredirect); |
171 |
exit; |
172 |
} |
173 |
} |
174 |
} |
175 |
|
176 |
$template->param( |
172 |
$template->param( |
177 |
biblio => $biblio |
173 |
biblio => $biblio |
178 |
); |
174 |
); |
179 |
- |
|
|