Bugzilla – Attachment 112156 Details for
Bug 26692
Add barcode image generator service for OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26692: Add barcode image generator service for OPAC
Bug-26692-Add-barcode-image-generator-service-for-.patch (text/plain), 3.72 KB, created by
Martin Renvoize (ashimema)
on 2020-10-22 08:22:47 UTC
(
hide
)
Description:
Bug 26692: Add barcode image generator service for OPAC
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-10-22 08:22:47 UTC
Size:
3.72 KB
patch
obsolete
>From c4ca477342ba22bf96f639e7cd42b7ca14305c87 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 15 Oct 2020 08:58:17 -0400 >Subject: [PATCH] Bug 26692: Add barcode image generator service for OPAC >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Some libraries would like to add a scannable barcode to the patron self >service area of the opac for patrons who do not have their library cards >with them. The existing svc/barcode on the staff side should work fine, >but requires a staff login. It makes sense to duplicate this script >but only require a valid patron login to use it. > >Test Plan: >1) Apply this patch >2) Browse to /cgi-bin/koha/svc/barcode?barcode=123456789 from your OPAC address >3) Note the barcode image > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > opac/svc/barcode | 122 +++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 122 insertions(+) > create mode 100755 opac/svc/barcode > >diff --git a/opac/svc/barcode b/opac/svc/barcode >new file mode 100755 >index 0000000000..15890fb902 >--- /dev/null >+++ b/opac/svc/barcode >@@ -0,0 +1,122 @@ >+#!/usr/bin/perl >+ >+# Copyright 2014 ByWater Solutions >+# >+# 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 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 <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI qw(header); >+use GD::Barcode; >+ >+use C4::Auth qw(checkauth); >+ >+=head1 NAME >+ >+/cgi-bin/koha/svc/barcode >+ >+=head1 SYNOPSIS >+ >+This service generates a PNG barcode image for the requested barcode. >+ >+=head2 PARAMETERS >+ >+=over >+ >+=item I<barcode> >+ >+I<barcode> is the desired barcode. It should be called like: >+ >+=item I<type> >+ >+I<type> is the desired barcode type. Possible values are >+Code39 >+UPCE >+UPCA >+QRcode >+NW7 >+Matrix2of5 >+ITF >+Industrial2of5 >+IATA2of5 >+EAN8 >+EAN13 >+COOP2of5 >+ >+If ommited,it defaults to Code39. >+ >+=item I<notext> >+ >+Unless I<notext=1> is specified in the parameter list, the >+value of the barcode will included as text below the >+scannable barcode. >+ >+ >+=back >+ >+=head2 EXAMPLES >+ >+=over >+ >+=item /cgi-bin/koha/svc/barcode?barcode=123456789 >+ >+Returns a Code39 barcode image for barcode 123456789 >+ >+=item /cgi-bin/koha/svc/barcode?barcode=123456789&type=UPCE >+ >+Returns a UPCE barcode image for barcode 123456789 >+ >+=item /cgi-bin/koha/svc/barcode?barcode=123456789¬ext=1 >+ >+Returns a Code39 barcode image for barcode 123456789 >+which does not include the human readable text '123456789' >+below the scannable barcode. >+ >+=back >+ >+=cut >+ >+my $input = CGI->new; >+ >+my ( $user, $cookie, $sessionID, $flags ) = checkauth( $input, 1, {}, 'opac' ); >+$user && $sessionID or response_bad_request("User not logged in"); >+ >+binmode(STDOUT); >+ >+my $type = $input->param('type') || 'Code39'; >+my $barcode = $input->param('barcode'); >+my $notext = $input->param('notext') ? 1 : 0; >+my $image; >+ >+eval { >+ $image = GD::Barcode->new( $type, $barcode )->plot( NoText => $notext )->png(); >+}; >+ >+if ( $@ ) { >+ # problem creating image >+ print header( -status => 500 ); >+} else { >+ print header('image/png'); >+ print $image; >+} >+ >+exit 0; >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=cut >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26692
:
111727
|
111728
|
111964
|
111975
|
112000
| 112156 |
112157
|
112662
|
139740
|
139741
|
139994