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 97-102 if ( !$biblio ) { Link Here
97
    exit;
97
    exit;
98
}
98
}
99
99
100
# If record should be suppressed, handle it early
101
if ( C4::Context->preference('OpacSuppression') ) {
102
103
    # redirect to opac-blocked info page or 404?
104
    my $redirect_url;
105
    if ( C4::Context->preference("OpacSuppressionRedirect") ) {
106
        $redirect_url = "/cgi-bin/koha/opac-blocked.pl";
107
    } else {
108
        $redirect_url = "/cgi-bin/koha/errors/404.pl";
109
    }
110
    if ( $biblio->opac_suppressed() ) {
111
112
        # if OPAC suppression by IP address
113
        if ( C4::Context->preference('OpacSuppressionByIPRange') ) {
114
            my $IPAddress = $ENV{'REMOTE_ADDR'};
115
            my $IPRange   = C4::Context->preference('OpacSuppressionByIPRange');
116
            if ( $IPAddress !~ /^$IPRange/ ) {
117
                print $query->redirect($redirect_url);
118
                exit;
119
            }
120
        } else {
121
            print $query->redirect($redirect_url);
122
            exit;
123
        }
124
    }
125
}
126
100
unless ( $patron and $patron->category->override_hidden_items ) {
127
unless ( $patron and $patron->category->override_hidden_items ) {
101
    # only skip this check if there's a logged in user
128
    # only skip this check if there's a logged in user
102
    # and its category overrides OpacHiddenItems
129
    # 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 $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
- 

Return to bug 28478