Bug 20676

Summary: svc/barcode should allow barcode to be printed without text
Product: Koha Reporter: Barton Chittenden <barton>
Component: Web servicesAssignee: Barton Chittenden <barton>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: f.demians, kyle, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20894
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Extends Koha /svc/barcode HTTP API. Adds a notext=1 parameter to the entry point in order to prevent the display of barcode text under the barcode's image.
Version(s) released in:
Bug Depends on: 13545    
Bug Blocks: 23144    
Attachments: Bug 20676: svc/barcode should allow barcode to be printed without text
Bug 20676: svc/barcode should allow barcode to be printed without text
Bug 20676: svc/barcode should allow barcode to be printed without text
Bug 20676: svc/barcode should allow barcode to be printed without text
Bug 20676: svc/barcode should allow barcode to be printed without text

Description Barton Chittenden 2018-04-27 21:30:43 UTC
svc/barcode currently generates the barcode using

    $image = GD::Barcode->new( $type, $barcode )->plot()->png();

From perldoc GD::Barcode

  plot()
    $oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]);

    creates GD object with barcode image for the $sTxt specified at new
    method. $iHeight is height of the image. If NoText is 1, the image has no
    text image of $sTxt.

     ex.
      my $oGdB = GD::Barcode->new('EAN13', '123456789012');
      my $oGD = $oGdB->plot(NoText=>1, Height => 20);
      # $sGD is a GD image with Height=>20 pixels, with no text.
Comment 1 Barton Chittenden 2018-04-27 22:20:24 UTC Comment hidden (obsolete)
Comment 2 Barton Chittenden 2018-04-30 15:10:19 UTC Comment hidden (obsolete)
Comment 3 Frédéric Demians 2018-04-30 16:47:06 UTC Comment hidden (obsolete)
Comment 4 Barton Chittenden 2018-04-30 17:18:23 UTC Comment hidden (obsolete)
Comment 5 Barton Chittenden 2018-04-30 17:20:01 UTC
(In reply to Barton Chittenden from comment #4)
> Created attachment 74942 [details] [review] [review]
> Bug 20676: svc/barcode should allow barcode to be printed without text
> 
> 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>

This was just removing warnings that I was using for debugging.
Comment 6 Jonathan Druart 2018-05-28 18:49:04 UTC
Created attachment 75600 [details] [review]
Bug 20676: svc/barcode should allow barcode to be printed without text

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>
Comment 7 Nick Clemens 2018-06-22 22:05:16 UTC
Awesome work all!

Pushed to master for 18.11.x
Comment 8 Martin Renvoize 2018-06-27 10:29:14 UTC
Enhancement, not backporting for 18.05.x series.