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

(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 428-430 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) V Link Here
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
430
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo');
430
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo');
431
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacSuppressionRedirect','1','Redirect the opac detail page for suppressed records to an explanatory page (otherwise redirect to 404 error page)','','YesNo');
432
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea');
(-)a/installer/data/mysql/updatedatabase.pl (+9 lines)
Lines 7044-7049 if ( CheckVersion($DBversion) ) { Link Here
7044
    SetVersion($DBversion);
7044
    SetVersion($DBversion);
7045
}
7045
}
7046
7046
7047
$DBversion = "3.13.00.XXX";
7048
if ( CheckVersion($DBversion) ) {
7049
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacSuppressionRedirect','1','Redirect the opac detail page for suppressed records to an explanatory page (otherwise redirect to 404 error page)','','YesNo')");
7050
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacSuppressionMessage', '','Display this message on the redirect page for suppressed biblios','70|10','Textarea')");
7051
    print "Upgrade to $DBversion done (Bug 10195: Records hidden with OpacSuppression can still be accessed)\n";
7052
    SetVersion($DBversion);
7053
}
7054
7055
7047
=head1 FUNCTIONS
7056
=head1 FUNCTIONS
7048
7057
7049
=head2 TableExists($table)
7058
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-1 / +10 lines)
Lines 156-165 Cataloging: Link Here
156
                  yes: Hide
156
                  yes: Hide
157
                  no: "Don't hide"
157
                  no: "Don't hide"
158
            - items marked as suppressed from OPAC search results. Note that you must have the <code>Suppress</code> index set up in Zebra and at least one suppressed item, or your searches will be broken.
158
            - items marked as suppressed from OPAC search results. Note that you must have the <code>Suppress</code> index set up in Zebra and at least one suppressed item, or your searches will be broken.
159
            - Restrict the suppression to IP adresses outside of the IP range
159
            - <br />Restrict the suppression to IP adresses outside of the IP range
160
            - pref: OpacSuppressionByIPRange
160
            - pref: OpacSuppressionByIPRange
161
              class: short
161
              class: short
162
            - (Leave blank if not used. Define a range like <code>192.168.</code>.)
162
            - (Leave blank if not used. Define a range like <code>192.168.</code>.)
163
            - <br />Redirect the opac detail page for suppressed records to
164
            - pref: OpacSuppressionRedirect
165
              choices:
166
                  yes: "an explanatory page ('This record is blocked')."
167
                  no: "the 404 error page ('Not found')."
168
            - <br />Display the following message on the redirect page for suppressed biblios
169
            - pref: OpacSuppressionMessage
170
              type: textarea
171
              class: code
163
        -
172
        -
164
            - pref: SeparateHoldings
173
            - pref: SeparateHoldings
165
              choices:
174
              choices:
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-blocked.tt (+32 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo;  Blocked
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
<body id="opac-blocked">
6
[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %]
7
<div id="bd">
8
[% INCLUDE 'masthead.inc' %]
9
10
<div id="yui-main">
11
<div class="yui-b">
12
<div class="yui-g">
13
            <div id="opac-blocked-message">
14
                <h3>Blocked</h3>
15
                <p>You are not authorized to view this record.</p>
16
                [% IF ( OpacSuppressionMessage ) %]
17
                    <div id="opacsuppressionmessage">
18
                        <p>[% OpacSuppressionMessage %]</p>
19
                    </div>
20
                [% END %]
21
            </div>
22
</div>
23
</div>
24
</div>
25
[% IF ( OpacNav ) %]
26
<div class="yui-b">
27
<div id="leftmenus" class="container">
28
[% INCLUDE 'navigation.inc' %]
29
</div>
30
</div>[% END %]
31
</div>
32
[% INCLUDE 'opac-bottom.inc' %]
(-)a/opac/opac-blocked.pl (+38 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along with
15
# Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18
19
use strict;
20
use warnings;
21
use CGI;
22
use C4::Auth;
23
use C4::Output;
24
use C4::Context;
25
26
my $query = new CGI;
27
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
28
    {
29
        template_name   => "opac-blocked.tt",
30
        query           => $query,
31
        type            => "opac",
32
        authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
33
    }
34
);
35
36
$template->param ( OpacSuppressionMessage => C4::Context->preference('OpacSuppressionMessage'));
37
38
output_with_http_headers $query, $cookie, $template->output, 'html';
(-)a/opac/opac-detail.pl (-1 / +30 lines)
Lines 78-83 if ( ! $record ) { Link Here
78
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
78
    print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
79
    exit;
79
    exit;
80
}
80
}
81
82
# redirect if opacsuppression is enabled and biblio is suppressed
83
if (C4::Context->preference('OpacSuppression')) {
84
    my $opacsuppressionfield = '942';
85
    my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield);
86
    # redirect to opac-blocked info page or 404?
87
    my $opacsuppressionredirect;
88
    if ( C4::Context->preference("OpacSuppressionRedirect") ) {
89
        $opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl";
90
    }
91
    else {
92
        $opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl";
93
    }
94
    if ( $opacsuppressionfieldvalue->subfield("n") == 1) {
95
        # if OPAC suppression by IP address
96
        if (C4::Context->preference('OpacSuppressionByIPRange')) {
97
            my $IPAddress = $ENV{'REMOTE_ADDR'};
98
            my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
99
            if ($IPAddress !~ /^$IPRange/)  {
100
                print $query->redirect($opacsuppressionredirect);
101
                exit;
102
            }
103
         }
104
        else {
105
            print $query->redirect($opacsuppressionredirect);
106
            exit;
107
        }
108
    }
109
}
110
81
$template->param( biblionumber => $biblionumber );
111
$template->param( biblionumber => $biblionumber );
82
112
83
# get biblionumbers stored in the cart
113
# get biblionumbers stored in the cart
84
- 

Return to bug 10195