Patron Image Capture via Webcam Instead of uploading a file, capture the image directly from a webcam --- .../prog/en/includes/circ-toolbar.inc | 2 + .../prog/en/includes/members-toolbar.inc | 2 + .../prog/en/modules/members/member-captureimage.tt | 557 ++++++++++++++++++++ .../intranet-tmpl/prog/img/jscam_canvas_only.swf | Bin 0 -> 1546 bytes members/member-captureimage.pl | 79 +++ tools/picture-image-upload.pl | 60 +++ 6 files changed, 700 insertions(+), 0 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/member-captureimage.tt create mode 100644 koha-tmpl/intranet-tmpl/prog/img/jscam_canvas_only.swf create mode 100755 members/member-captureimage.pl create mode 100755 tools/picture-image-upload.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc index 503f954..8bbfa05 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-toolbar.inc @@ -102,6 +102,7 @@ function update_child() { new YAHOO.widget.Button("duplicate"); new YAHOO.widget.Button("printslip"); new YAHOO.widget.Button("printpage"); + new YAHOO.widget.Button("captureimage"); new YAHOO.widget.Button("renewpatron"); [% IF ( CAN_user_permissions ) %] [% IF ( StaffMember ) %] @@ -139,6 +140,7 @@ function update_child() { [% IF ( StaffMember ) %][% IF ( CAN_user_staffaccess ) %]
  • Change Password
  • [% END %] [% ELSE %]
  • Change Password
  • [% END %] [% END %] + [% IF ( patronimages ) %]
  • Capture Image
  • [% END %]
  • Duplicate
  • Print Page
  • Print Slip
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index afad863..f5b0748 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -92,6 +92,7 @@ function update_child() { new YAHOO.widget.Button("editpatron"); new YAHOO.widget.Button("addnote"); new YAHOO.widget.Button("changepassword"); + new YAHOO.widget.Button("captureimage"); new YAHOO.widget.Button("duplicate"); new YAHOO.widget.Button("printslip"); new YAHOO.widget.Button("printpage"); @@ -120,6 +121,7 @@ function update_child() { [% END %] [% IF ( adultborrower ) %]
  • Add child
  • [% END %]
  • Change Password
  • + [% IF ( patronimages ) %]
  • Capture Image
  • [% END %]
  • Duplicate
  • Print Page
  • Print Slip
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-captureimage.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-captureimage.tt new file mode 100644 index 0000000..7d0e7cb --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member-captureimage.tt @@ -0,0 +1,557 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Patrons › Capture Photo and Signature for [% surname %], [% firstname %] +[% INCLUDE 'doc-head-close.inc' %] + + + + + + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'patron-search.inc' %] + + + +
    + + +
    +
    +
    +[% INCLUDE 'members-toolbar.inc' %] + + + + + + + + + +

    +
    + +
    +[% IF ( patronimages ) %] + [% IF ( CAN_user_tools_batch_upload_patron_images ) %] +
    + + + + + +
    + + + [% IF ( picture ) %]Delete[% END %] +
    + +
    + [% END %] +[% END %] +
    + + + + +
    +
    + +
    +[% INCLUDE 'circ-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] + diff --git a/koha-tmpl/intranet-tmpl/prog/img/jscam_canvas_only.swf b/koha-tmpl/intranet-tmpl/prog/img/jscam_canvas_only.swf new file mode 100644 index 0000000000000000000000000000000000000000..c785648599c37fef6952802007473b853bb188e3 GIT binary patch literal 1546 zcmV+l2KD(vS5pY+4gdgn+O$_sbK6u9U;S|`CvDOM8mA= z+t>|Pk77SN8f-~Oa?(sM+~}z@%rKtez=Z=>IKWpZ2lyZy;S-qMeX^w(H^~7Gk>7j! z=k5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$BmP}GZ1rhx5VlXPOC0w@557k#bA6I=B*ZnkbJA(G8@XNW{Ht$j<2=%mDkPBiWMT^Pg4!>XdbfqU=#>EKmSLparam('theme') || "default"; + +my ($template, $loggedinuser, $cookie, $staffflags) + = get_template_and_user({template_name => "members/member-captureimage.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {borrowers => 1}, + debug => 1, + }); + +my $flagsrequired; +$flagsrequired->{borrowers}=1; + +my $borrowernumber=$input->param('borrowernumber'); +my $cardnumber = $input->param('cardnumber'); +my $destination = $input->param('destination'); +my $errormsg; +my ($bor)=GetMember('borrowernumber' => $borrowernumber); +my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); +$template->param( picture => 1 ) if $picture; +$template->param( + borrowernumber => $borrowernumber, + othernames => $bor->{'othernames'}, + surname => $bor->{'surname'}, + firstname => $bor->{'firstname'}, + cardnumber => $bor->{'cardnumber'}, + categorycode => $bor->{'categorycode'}, + category_type => $bor->{'category_type'}, + categoryname => $bor->{'description'}, + address => $bor->{'address'}, + address2 => $bor->{'address2'}, + city => $bor->{'city'}, + zipcode => $bor->{'zipcode'}, + country => $bor->{'country'}, + phone => $bor->{'phone'}, + email => $bor->{'email'}, + branchcode => $bor->{'branchcode'}, + branchname => GetBranchName($bor->{'branchcode'}), + userid => $bor->{'userid'}, + destination => $destination, + + ); + +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/tools/picture-image-upload.pl b/tools/picture-image-upload.pl new file mode 100755 index 0000000..da63270 --- /dev/null +++ b/tools/picture-image-upload.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# Copyright 2011 Nucsoft osslabs +# +# 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 File::Temp; +use File::Copy; +use CGI; +use GD; +use C4::Context; +use C4::Auth; +use C4::Output; +use C4::Members; +use C4::Debug; +use MIME::Base64; + +my $input = new CGI; + +my $filetype = $input->param('filetype'); +my $cardnumber = $input->param('cardnumber'); +my $borrowernumber = $input->param('borrowernumber'); +my $op = $input->param('op'); +my $dataurlphoto = $input->param('dataurlphoto'); +my $dataurlsign = $input->param('dataurlsign'); +my $image = decode_base64($dataurlphoto); + +$debug and warn "Params are: cardnumber=$cardnumber, borrowernumber=$borrowernumber, image=$image"; + + my $mimetype = 'image/png'; + my $dberror = PutPatronImage($cardnumber,$mimetype, $image, $op) if $mimetype; + + if ( $dberror ) { + warn "Database returned error: $dberror"; + ($dberror =~ /patronimage_fk1/) ? $filerrors{'IMGEXISTS'} = 1 : $filerrors{'DBERR'} = 1; + push my @filerrors, \%filerrors; + push @{ $count{filenames} }, { filerrors => \@filerrors, image => $image, cardnumber => $cardnumber }; + $template->param( ERRORS => 1 ); + } + +if ( $borrowernumber) { + print $input->redirect ("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); +} else { + output_html_with_http_headers $input, $cookie, $template->output; +} +