Koha/opac/opac-blocked.pl
Mirko Tietgen f2ad0d7424 Bug 10195: hide bib details page for OPAC-suppressed bibs
Records hidden with OpacSuppression are filtered from the search
results, but the opac-detail page is still visible if you know the
biblio number. This patch hides the detail page for suppressed biblios
by redirecting (controlled by the syspref OpacSuppressionRedirect)
either to opac-blocked (default), explaining that the record is blocked
(including optional explanatory text from the syspref
OpacSuppressionMessage) or to Koha's 404 page, giving no hint that a
biblio with that number exists in the system.

Test plan:

Make sure you have at least one record with 942$n == 1.
Set OpacSuppression to "Don't hide".

Do an OPAC search that should bring up your hidden record and other
records.
  Observe that your record is found.
Open the detail page for the record.
  Observe that it is accessible. Copy the URL for later(!).

Set OpacSuppression to "Hide".
Leave OpacSuppressionByIPRange blank.
Set OpacSuppressionRedirect to "an explanatory page ('This record is
blocked')."
Leave OpacSuppressionMessage blank for now.
Disable queryparser(!) (because of bug 10542).

Do a full zebra reindex.

Do an OPAC search that should bring up your hidden record and other
records.
  Observe that your record is not found.
Open the opac-detail URL of the record (the one you copied before).
  Observe that you are redirected to opac-blocked and it displays a
short standard message.

Edit OpacSuppressionMessage and input some text.
Open the opac-detail URL of the record again (the one you copied
before).
  Observe that the text you entered in OpacSuppressionMessage is
displayed under the standard text you have seen before.

Set OpacSuppressionRedirect to "the 404 error page ('Not found')."
Open the opac-detail URL of the record again (the one you copied before).
  Observe that you are redirected to Koha's 404 error page.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-05-05 15:32:53 +00:00

38 lines
1.2 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
use strict;
use warnings;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Context;
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-blocked.tt",
query => $query,
type => "opac",
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
}
);
$template->param ( OpacSuppressionMessage => C4::Context->preference('OpacSuppressionMessage'));
output_with_http_headers $query, $cookie, $template->output, 'html';