[Koha-patches] [PATCH] bug 3436: add patron images to web self-check

Galen Charlton galen.charlton at liblime.com
Wed Jul 22 23:43:41 CEST 2009


Adds a new system preference, ShowPatronImageInWebBasedSelfCheck;
if this preference is ON, a patron's image is displayed
if available when using web-based self-check.

Note: a patch for updatedatabase.pl will be made when this
change is ready to push.

This change is sponsored by the Plano Indepdent School
District.
---
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 .../opac-tmpl/prog/en/modules/sco/sco-main.tmpl    |    3 +
 opac/sco/sco-main.pl                               |    9 ++++
 opac/sco/sco-patron-image.pl                       |   41 ++++++++++++++++++++
 5 files changed, 55 insertions(+), 0 deletions(-)
 create mode 100755 opac/sco/sco-patron-image.pl

diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index a978fad..aef4b57 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -245,3 +245,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('v
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewLabeledMARC','0','Allow display of labeled MARC view of bibiographic records','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewMARC','1','Allow display of MARC view of bibiographic records','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('FilterBeforeOverdueReport','0','Do not run overdue report until filter selected','','YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'If ON, displays patron image when a patron uses web-based self-checkout', '', 'YesNo');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 424b716..91ccff8 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -247,3 +247,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('v
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewLabeledMARC','0','Autoriser l''affichage MARC labellis des notices bibliographiques','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('viewMARC','1','Autoriser l''affichage de la vue MARC des notices bibliographiques','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('FilterBeforeOverdueReport','0','Ne pas lancer le rapport sur les retards tant qu''il n''y a pas de filtre','','YesNo');
+INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('ShowPatronImageInWebBasedSelfCheck', '0', 'Si activé, affiche la photo de l''adhérent lors de l''utilisation de la console de prêt auto-contrôlé', '', 'YesNo');
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl
index 4d5a88d..01e4454 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/sco/sco-main.tmpl
@@ -104,6 +104,9 @@ Sorry, This Self-Checkout Station has lost authentication.  Please contact the a
 	<!-- TMPL_IF NAME="patronid" -->
 	<!-- TMPL_IF NAME="validuser" -->
 	<h3 class="warning">You are logged in as <!-- TMPL_VAR NAME="borrowername" -->.</h3>
+    <!-- TMPL_IF NAME="display_patron_image" -->
+        <img src="/cgi-bin/koha/sco/sco-patron-image.pl?cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->" alt="" />
+    <!-- /TMPL_IF -->
 	<!-- /TMPL_IF -->
 	</div>
 	<!-- TMPL_IF NAME="nouser" -->
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl
index 9b15ac5..2a5afd0 100755
--- a/opac/sco/sco-main.pl
+++ b/opac/sco/sco-main.pl
@@ -165,6 +165,15 @@ if ($borrower->{cardnumber}) {
         inputfocus => $inputfocus,
 		nofines => 1,
     );
+    if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) {
+        my ($image, $dberror) = GetPatronImage($borrower->{cardnumber});
+        if ($image) {
+            $template->param(
+                display_patron_image => 1,
+                cardnumber           => $borrower->{cardnumber},
+            );
+        }
+    }
 } else {
     $template->param(
         patronid   => $patronid,
diff --git a/opac/sco/sco-patron-image.pl b/opac/sco/sco-patron-image.pl
new file mode 100755
index 0000000..8e94fde
--- /dev/null
+++ b/opac/sco/sco-patron-image.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+#
+# Copyright 2009 LibLime
+#
+# 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., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+use strict;
+use warnings;
+use C4::Service;
+use C4::Members;
+
+my ($query, $response) = C4::Service->init(circulate => 'circulate_remaining_permissions');
+my ($cardnumber) = C4::Service->require_params('cardnumber');
+
+my ($imagedata, $dberror) = GetPatronImage($cardnumber);
+
+if ($dberror) {
+    print $query->header(status => '500 internal error');
+}
+
+if ($imagedata) {
+    print $query->header(-type => $imagedata->{'mimetype'}, 
+                         -'Cache-Control' => 'no-store', 
+                         -Content_Length => length ($imagedata->{'imagefile'})), 
+          $imagedata->{'imagefile'};
+} else {
+    print $query->header(status => '404 patron image not found');
+}
-- 
1.5.6.5



More information about the Koha-patches mailing list