From 121a4ca0d17acb92993377fb51e10176bf439f83 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 22 Jul 2009 16:43:41 -0500 Subject: [PATCH] bug 3436: add patron images to web self-check 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 Independent School District. Signed-off-by: Galen Charlton --- .../data/mysql/en/mandatory/sysprefs.sql | 1 + .../unimarc_standard_systemprefs.sql | 1 + .../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(+) 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 fdbef70c0e..6f60fa718b 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -261,3 +261,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACFinesTab','1','If OFF the patron fines tab in the OPAC is disabled.','','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'If ON, displays the format, audience, type icons in XSLT MARC21 results and display pages.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','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 3cb8878a39..bee360a606 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 @@ -260,3 +260,4 @@ INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'Active l''affichage du numéro des adhérents à la place de leur nom dans les pages de réservation et du catalogue.', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('DisplayOPACiconsXSLT', '1', '', 'Si activé, affiche le format, le type de public et les icônes de type en XSLT (MARC21)).', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowAllMessageDeletion','0','Allow any Library to delete any message','','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 4d5a88d66f..01e4454177 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

You are logged in as .

+ + " alt="" /> + diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 9b15ac58e5..2a5afd0e9f 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 0000000000..8e94fde7eb --- /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'); +} -- 2.20.1