Bug 3516 [REVISED] Display picture of patrons in OPAC
This patch adapts the patron image display script from the self-checkout module to optionally display the image of the logged-in user on their personal information page (opac-userupdate.pl). The script changes the method choosing which image to display from using a passed cardnumber to using the borrowernumber of the logged-in user. A system preference is added, OPACpatronimages, to control whether these images are displayed. Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Verified that patron image shows only when system preference is turned on and that there are no display problems for patrons without patron image.
This commit is contained in:
parent
5716b69d16
commit
b5e27d047c
|
|
@ -96,6 +96,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
|
|||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacuserjs','','Define custom javascript for inclusion in OPAC','70|10','Textarea');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('opacuserlogin',1,'Enable or disable display of user login features',NULL,'YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('patronimages',0,'Enable patron images for the Staff Client',NULL,'YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACpatronimages',0,'Enable patron images in the OPAC',NULL,'YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('printcirculationslips',1,'If ON, enable printing circulation receipts','','YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RecordLocalUseOnReturn',0,'If ON, statistically record returns of unissued items as local use, instead of return',NULL,'YesNo');
|
||||
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RequestOnOpac',1,'If ON, globally enables patron holds on OPAC',NULL,'YesNo');
|
||||
|
|
|
|||
|
|
@ -4734,6 +4734,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
|
|||
SetVersion($DBversion);
|
||||
}
|
||||
|
||||
$DBversion = "3.07.00.XXX";
|
||||
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
||||
$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACpatronimages',0,'Enable patron images in the OPAC',NULL,'YesNo');");
|
||||
print "Upgrade to $DBversion done (Bug 3516: Add the option to show patron images in the OPAC.)\n";
|
||||
SetVersion($DBversion);
|
||||
}
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
=head2 DropAllForeignKeys($table)
|
||||
|
|
|
|||
|
|
@ -234,6 +234,12 @@ OPAC:
|
|||
yes: Allow
|
||||
no: "Don't allow"
|
||||
- patrons to notify the library of changes to their contact information from the OPAC.
|
||||
-
|
||||
- pref: OPACpatronimages
|
||||
choices:
|
||||
yes: Show
|
||||
no: "Don't show"
|
||||
- patron images on the patron information page in the OPAC.
|
||||
-
|
||||
- pref: OPACFinesTab
|
||||
choices:
|
||||
|
|
|
|||
|
|
@ -11,12 +11,15 @@
|
|||
|
||||
<div id="userupdatecontainer" class="container">
|
||||
[% FOREACH BORROWER_INF IN BORROWER_INFO %]
|
||||
<h3><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' ifirstname = BORROWER_INF.firstname surname = BORROWER_INF.surname othernames = BORROWER_INF.othernames cardnumber = BORROWER_INF.cardnumber %]'s account</a> <img src="[% themelang %]../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Your Personal Details</h3>
|
||||
<h3><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' firstname = BORROWER_INF.firstname surname = BORROWER_INF.surname othernames = BORROWER_INF.othernames cardnumber = BORROWER_INF.cardnumber %]'s account</a> <img src="[% themelang %]../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Your Personal Details</h3>
|
||||
|
||||
[% IF ( OPACPatronDetails ) %]
|
||||
<form action="/cgi-bin/koha/opac-userupdate.pl" method="get">
|
||||
<div class="yui-u first">
|
||||
<input type="hidden" name="modify" value="yes" />
|
||||
[% IF ( display_patron_image ) %]<p style="border:1px solid #EEE;padding:1em;">
|
||||
<img src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
|
||||
</p>[% END %]
|
||||
<fieldset class="brief"><legend>Name</legend><ol>
|
||||
<li><label for="firstname">First Name:</label> <input id="firstname" type="text" value="[% BORROWER_INF.firstname %]" name="firstname" /></li>
|
||||
<li><label for="othernames">Other Name:</label> <input id="othernames" type="text" value="[% BORROWER_INF.othernames %]" name="othernames" /></li>
|
||||
|
|
@ -102,6 +105,9 @@
|
|||
[% ELSE %]
|
||||
<p style="clear:left;padding:1em 0">To make changes to your record please contact the library.</p>
|
||||
<div class="yui-u first">
|
||||
[% IF ( display_patron_image ) %]<p style="border:1px solid #EEE;border-bottom-color:#000;padding:1em;">
|
||||
<img src="/cgi-bin/koha/opac-patron-image.pl" alt="" />
|
||||
</p>[% END %]
|
||||
<fieldset class="rows">
|
||||
<legend>Contact Information</legend>
|
||||
<ol>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright 2009 LibLime
|
||||
# Parts copyright 2012 Athens County Public Libraries
|
||||
#
|
||||
# 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 C4::Members;
|
||||
use C4::Auth;
|
||||
my $query = new CGI;
|
||||
|
||||
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
|
||||
{
|
||||
template_name => "opac-userupdate.tt",
|
||||
query => $query,
|
||||
type => "opac",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { borrow => 1 },
|
||||
debug => 1,
|
||||
}
|
||||
);
|
||||
|
||||
unless (C4::Context->preference('OPACpatronimages')) {
|
||||
print $query->header(status => '403 Forbidden - displaying patron images in the OPAC not enabled');
|
||||
exit;
|
||||
}
|
||||
|
||||
my ($borrower)=GetMember('borrowernumber' => $borrowernumber);
|
||||
my $cardnumber = $borrower->{'cardnumber'};
|
||||
my ($imagedata, $dberror) = GetPatronImage($cardnumber);
|
||||
|
||||
if ($dberror) {
|
||||
print $query->header(status => '500 internal error');
|
||||
}
|
||||
|
||||
if ($imagedata) {
|
||||
print $query->header(-type => $imagedata->{'mimetype'},
|
||||
-Content_Length => length ($imagedata->{'imagefile'})),
|
||||
$imagedata->{'imagefile'};
|
||||
} else {
|
||||
print $query->header(status => '404 patron image not found');
|
||||
}
|
||||
|
|
@ -170,6 +170,15 @@ for (@{ $checkout_prefs->{transports} }) {
|
|||
$borr->{"items_borrowed_$_"} = 1;
|
||||
}
|
||||
|
||||
if (C4::Context->preference('OPACpatronimages')) {
|
||||
my ($image, $dberror) = GetPatronImage($borr->{'cardnumber'});
|
||||
if ($image) {
|
||||
$template->param(
|
||||
display_patron_image => 1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
my @bordat;
|
||||
$bordat[0] = $borr;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue