Bug 20676: svc/barcode should allow barcode to be printed without text
authorBarton Chittenden <barton@bywatersolutions.com>
Fri, 27 Apr 2018 22:09:29 +0000 (22:09 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 22 Jun 2018 16:34:53 +0000 (16:34 +0000)
Test plan:

1) Point web browser to
   <staff url>/cgi-bin/koha/svc/barcode?barcode=*12345*&notext=1

   This will display a png image of the barcode *12345* with the
   text *12345* printed below the scannable barcode.

2) Apply patch
3) Refresh the browser. The human readable text no longer appears.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
svc/barcode

index 80b1504..89ea0a4 100755 (executable)
@@ -58,6 +58,13 @@ 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
@@ -72,7 +79,13 @@ Returns a Code39 barcode image for barcode 123456789
 
 Returns a UPCE barcode image for barcode 123456789
 
-=cut
+=item /cgi-bin/koha/svc/barcode?barcode=123456789&notext=1
+
+Returns a Code39 barcode image for barcode 123456789
+which does not include the human readable text '123456789'
+below the scannable barcode.
+
+=back
 
 my $input = new CGI;
 
@@ -86,10 +99,11 @@ 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()->png();
+    $image = GD::Barcode->new( $type, $barcode )->plot( NoText => $notext )->png();
 };
 
 if ( $@ ) {