From 4246cc6673b9da3ad76e200122ad6cf90cc4e927 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Fri, 5 Jul 2019 00:51:37 +0000 Subject: [PATCH] Bug 6815: Add a 'Take Patron Image' ability This does not just click in place, which would be nice. But it does take the picture, download to a file, and then let's the user use the existing upload functionality to add the photo. If wording or formating is ugly, feel free to tweak. TEST PLAN --------- 1) the 'patronimages' system preference in Patrons system preferences must be set to 'Allow'. 2) apply the patch 3) go to any patron 4) click the 'Take' button. -- it is in the text area on the right, and not the hover over the image area. Adding here would require CSS changes, which are now difficult and ugly to do. -- new tab should open. If you have a working webcam, you should see it playing 'live'. 5) click the "Take the Patron's Picture" button -- this should download a photo SamplePhoto.jpg or some variation of that. 6) close this tab, and click the 'Edit' or 'Add' button for the patron image. 7) click 'Choose File' and choose the file that was created 8) click 'Upload' -- the webcam photo should now be used. 9) run koha qa test tools --- .../prog/en/modules/members/member-webcam.tt | 107 +++++++++++++++++++++ .../prog/en/modules/members/moremember.tt | 4 + members/webcam.pl | 37 +++++++ 3 files changed, 148 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/member-webcam.tt create mode 100755 members/webcam.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-webcam.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-webcam.tt new file mode 100644 index 0000000000..7c254e2654 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-webcam.tt @@ -0,0 +1,107 @@ + + + + + + Koha Patron Image Via Webcam + + + + +

Koha Patron Image Taker

+

Ask the patron to face the webcam to take their picture.

+

WARNING: If your machine does not have a webcam, + your browser is not allowed camera access, your operating + system blocks the browser app from accessing the camera, + or your browser does not support the javascript used + in this page, this may not work and likely looks like + a empty page. If this is working you will see a video + playing of what the webcam sees.

+ + +
+ + + + + + + + + + + + + diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 05cb6c9478..9578fd0801 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -320,6 +320,10 @@ Cancel +
+

Take patron image

+ Take +
[% # /div#manage-patron-image %] [% END %] [% END %] diff --git a/members/webcam.pl b/members/webcam.pl new file mode 100755 index 0000000000..afc52b2a49 --- /dev/null +++ b/members/webcam.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Copyright 2019 Mark Tompsett +# +# 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 3 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, see . + +use Modern::Perl; + +use CGI qw ( -utf8 ); +use C4::Auth; +use C4::Output; + +my $input = new CGI; + +my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user( + { template_name => "members/member-webcam.tt", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { borrowers => 'edit_borrowers' }, + } +); + +output_html_with_http_headers( $input, $cookie, $template->output ); -- 2.11.0