bug 4122: make WebBasedSelfCheck functional
authorGalen Charlton <gmcharlt@gmail.com>
Wed, 10 Feb 2010 12:11:17 +0000 (07:11 -0500)
committerGalen Charlton <gmcharlt@gmail.com>
Wed, 10 Feb 2010 13:41:50 +0000 (08:41 -0500)
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@gmail.com>
opac/sco/sco-main.pl
opac/sco/sco-patron-image.pl

index 3295a92..9895892 100755 (executable)
@@ -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');
index a383afd..d7802b2 100755 (executable)
@@ -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);