Bugzilla – Attachment 19691 Details for
Bug 10195
Records hidden with OpacSuppression can still be accessed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10195 Records hidden with OpacSuppression can still be accessed
Bug-10195-Records-hidden-with-OpacSuppression-can-.patch (text/plain), 4.34 KB, created by
Mirko Tietgen
on 2013-07-16 12:09:48 UTC
(
hide
)
Description:
Bug 10195 Records hidden with OpacSuppression can still be accessed
Filename:
MIME Type:
Creator:
Mirko Tietgen
Created:
2013-07-16 12:09:48 UTC
Size:
4.34 KB
patch
obsolete
>From 3d753c25c28f16c120ff55028d47cb07bab96f16 Mon Sep 17 00:00:00 2001 >From: Mirko Tietgen <mirko@abunchofthings.net> >Date: Thu, 4 Jul 2013 00:50:43 +0200 >Subject: [PATCH] Bug 10195 Records hidden with OpacSuppression can still be accessed > >Initial commit >--- > .../opac-tmpl/prog/en/modules/opac-blocked.tt | 26 +++++++++++++ > opac/opac-blocked.pl | 39 ++++++++++++++++++++ > opac/opac-detail.pl | 25 +++++++++++++ > 3 files changed, 90 insertions(+), 0 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/opac-blocked.tt > create mode 100755 opac/opac-blocked.pl > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-blocked.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-blocked.tt >new file mode 100644 >index 0000000..810c78a >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-blocked.tt >@@ -0,0 +1,26 @@ >+[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › An error has occurred >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+<body id="error404"> >+[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %] >+<div id="bd"> >+[% INCLUDE 'masthead.inc' %] >+ >+<div id="yui-main"> >+<div class="yui-b"> >+<div class="yui-g"> >+ <div id="opac-blocked-message"> >+ <h3>Blocked</h3> >+ <p>[% blockedmessage %]</p> >+ </div> >+</div> >+</div> >+</div> >+[% IF ( OpacNav ) %] >+<div class="yui-b"> >+<div id="leftmenus" class="container"> >+[% INCLUDE 'navigation.inc' %] >+</div> >+</div>[% END %] >+</div> >+[% INCLUDE 'opac-bottom.inc' %] >diff --git a/opac/opac-blocked.pl b/opac/opac-blocked.pl >new file mode 100755 >index 0000000..5926753 >--- /dev/null >+++ b/opac/opac-blocked.pl >@@ -0,0 +1,39 @@ >+#!/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 ), >+ } >+); >+ >+my $blockedmessage = "You don't have permission to see this record."; >+ >+$template->param( blockedmessage => $blockedmessage ); >+output_with_http_headers $query, $cookie, $template->output, 'html'; >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 9d0851f..e921c7e 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -78,6 +78,31 @@ if ( ! $record ) { > print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early > exit; > } >+ >+# redirect if opacsuppression is enabled and biblio is suppressed >+if (C4::Context->preference('OpacSuppression')) { >+ my $opacsuppressionfield = '942'; >+ my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield); >+ # if OPAC suppression by IP address >+ if (C4::Context->preference('OpacSuppressionByIPRange')) { >+ my $IPAddress = $ENV{'REMOTE_ADDR'}; >+ my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); >+ if ($IPAddress !~ /^$IPRange/) { >+ if ( $opacsuppressionfieldvalue->subfield("n") == 1) { >+ print $query->redirect("/cgi-bin/koha/opac-blocked.pl"); >+ exit; >+ } >+ } >+ } >+ else { >+ if ( $opacsuppressionfieldvalue->subfield("n") == 1) { >+ print $query->redirect("/cgi-bin/koha/opac-blocked.pl"); >+ exit; >+ } >+ } >+} >+ >+ > $template->param( biblionumber => $biblionumber ); > > # get biblionumbers stored in the cart >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10195
:
19691
|
19693
|
19697
|
19873
|
20428