Bug 20676 - svc/barcode should allow barcode to be printed without text
Summary: svc/barcode should allow barcode to be printed without text
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Barton Chittenden
QA Contact: Testopia
URL:
Keywords:
Depends on: 13545
Blocks: 23144
  Show dependency treegraph
 
Reported: 2018-04-27 21:30 UTC by Barton Chittenden
Modified: 2022-01-05 12:25 UTC (History)
4 users (show)

See Also:
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:
Circulation function:


Attachments
Bug 20676: svc/barcode should allow barcode to be printed without text (1.70 KB, patch)
2018-04-27 22:20 UTC, Barton Chittenden
Details | Diff | Splinter Review
Bug 20676: svc/barcode should allow barcode to be printed without text (1.90 KB, patch)
2018-04-30 15:10 UTC, Barton Chittenden
Details | Diff | Splinter Review
Bug 20676: svc/barcode should allow barcode to be printed without text (2.04 KB, patch)
2018-04-30 16:47 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 20676: svc/barcode should allow barcode to be printed without text (1.84 KB, patch)
2018-04-30 17:18 UTC, Barton Chittenden
Details | Diff | Splinter Review
Bug 20676: svc/barcode should allow barcode to be printed without text (1.92 KB, patch)
2018-05-28 18:49 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 (kidclamp) 2018-06-22 22:05:16 UTC
Awesome work all!

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