Bugzilla – Attachment 35913 Details for
Bug 13545
Add barcode image generator service
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13545: (followup) POD and error handling
Bug-13545-followup-POD-and-error-handling.patch (text/plain), 2.03 KB, created by
Kyle M Hall (khall)
on 2015-02-13 16:22:24 UTC
(
hide
)
Description:
Bug 13545: (followup) POD and error handling
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-02-13 16:22:24 UTC
Size:
2.03 KB
patch
obsolete
>From 9a269214976a57525e998ce41bc457ca4f1aa731 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Tue, 10 Feb 2015 12:52:25 -0300 >Subject: [PATCH] Bug 13545: (followup) POD and error handling > >This patch adds POD to the new /svc/barcode service, and also implements some >error handling. > >Sponsored-by: Universidad Nacional de Cordoba >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > svc/barcode | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- > 1 files changed, 57 insertions(+), 2 deletions(-) > >diff --git a/svc/barcode b/svc/barcode >index 8c4e745..1a00c1f 100755 >--- a/svc/barcode >+++ b/svc/barcode >@@ -24,6 +24,43 @@ use GD::Barcode; > > use C4::Auth qw(check_cookie_auth); > >+=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 TODO. If ommited, >+it defaults to Code39. >+ >+=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 >+ >+=cut >+ > my $input = new CGI; > > my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { catalogue => '*' } ); >@@ -36,6 +73,24 @@ binmode(STDOUT); > > my $type = $input->param('type') || 'Code39'; > my $barcode = $input->param('barcode'); >+my $image; >+ >+eval { >+ $image = GD::Barcode->new( $type, $barcode )->plot()->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> > >-print header('image/png'); >-print GD::Barcode->new( $type, $barcode )->plot()->png(); >+=cut >\ No newline at end of file >-- >1.7.2.5
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 13545
:
35094
|
35095
|
35103
|
35128
|
35325
|
35806
|
35912
| 35913 |
35914
|
35915