[Koha-patches] [PATCH] bug 4122: make WebBasedSelfCheck functional

Galen Charlton gmcharlt at gmail.com
Wed Feb 10 13:11:17 CET 2010


The WebBasedSelfCheck preference is now functional - if a user
tries to use /cgi-bin/koha/sco/sco-main.pl if the preference
is not on, they get redirected to the OPAC home page.

Also, the patron image web service now returns HTTP 403 (forbidden) unless
both WebBasedSelfCheck and ShowPatronImageInWebBasedSelfCheck are on.

Signed-off-by: Galen Charlton <gmcharlt at gmail.com>
---
 opac/sco/sco-main.pl         |    7 +++++++
 opac/sco/sco-patron-image.pl |   10 ++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index 3295a92..9895892 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -31,6 +31,13 @@ use C4::Biblio;
 use C4::Items;
 
 my $query = new CGI;
+
+unless (C4::Context->preference('WebBasedSelfCheck')) {
+    # redirect to OPAC home if self-check is not enabled
+    print $query->redirect("/cgi-bin/koha/opac-main.pl");
+    exit;
+}
+
 if (C4::Context->preference('AutoSelfCheckAllowed')) 
 {
 	my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
diff --git a/opac/sco/sco-patron-image.pl b/opac/sco/sco-patron-image.pl
index a383afd..d7802b2 100755
--- a/opac/sco/sco-patron-image.pl
+++ b/opac/sco/sco-patron-image.pl
@@ -23,6 +23,16 @@ use C4::Service;
 use C4::Members;
 
 my ($query, $response) = C4::Service->init(circulate => 'circulate_remaining_permissions');
+
+unless (C4::Context->preference('WebBasedSelfCheck')) {
+    print $query->header(status => '403 Forbidden - web-based self-check not enabled');
+    exit;
+}
+unless (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) {
+    print $query->header(status => '403 Forbidden - displaying patron images in self-check not enabled');
+    exit;
+}
+
 my ($cardnumber) = C4::Service->require_params('cardnumber');
 
 my ($imagedata, $dberror) = GetPatronImage($cardnumber);
-- 
1.6.3.3




More information about the Koha-patches mailing list