Bug 39969 - Show a single (line-based image) barcode of a selected item under cataloguing/additem.pl
Summary: Show a single (line-based image) barcode of a selected item under cataloguing...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Label/patron card printing (show other bugs)
Version: 24.11
Hardware: All All
: P5 - low enhancement
Assignee: Chris Nighswonger
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-22 11:04 UTC by Theodoros Theodoropoulos
Modified: 2025-05-22 11:21 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Theodoros Theodoropoulos 2025-05-22 11:04:37 UTC
There could be use cases where one would like to show the barcode image that is generated from ONE, previously created item in the cataloguing/additem page.

One such case would be to send this ONE barcode image to a label printer without having to go over all the required steps to generate a batch of ONE barcode, create a PDF and print it.

This extra functionality is easy to implement using the -already present- action submenu and the -also already present- /svc/barcode?barcode=XXX endpoint, by adding a few simple lines of code in the /modules/cataloguing/additem.tt template.

Alternatively, one could generate such a popup with an onmouseover event when hovering over the barcode number.
Comment 1 Theodoros Theodoropoulos 2025-05-22 11:09:52 UTC
Kudos to Fridolin for the quick brainstorming, where he mentioned the /svc/barcode?barcode=XXX endpoint :)

Alternative JS library that seems promising and could be applied to end-user's browser:
https://github.com/lindell/JsBarcode?tab=readme-ov-file
Comment 2 Theodoros Theodoropoulos 2025-05-22 11:15:20 UTC
The 2D barcode creation library has a 'bug', that makes the default created barcode images unreadable under dark-themed browsers. The barcode image itself is OK, the dark background combined with the black lines of the barcode create the issue. I've opened an issue to the GD:Barcode library author, here: https://github.com/mbeijen/GD-Barcode/issues/9
QR barcodes are not affected, as they have a white border already applied around the black dots.
Comment 3 Theodoros Theodoropoulos 2025-05-22 11:21:54 UTC
I'm not submitting a .patch file, because I know you'll fine-tune the code several times before it's accepted, you'll need a QA/test procedure, etc, but the simple/ugly looking but working prototype would be something like that:

--- /home/koha/src/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt.orig       2025-05-20 17:55:30.691074105 +0300
+++ /home/koha/src/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt    2025-05-22 12:42:35.295432403 +0300
@@ -138,9 +138,6 @@
  <li class="print_label">
  <a class="dropdown-item submit-form-link" target="_blank" href="#" data-op="cud-add" data-number_list="[% item.itemnumber | html %]" data-number_type="itemnumber" data-method="post" data-action="/cgi-bin/koha/labels/label-edit-batch.pl" data-new_tab="true">Print label</a>
  </li>
+ <li class="show_barcode">
+ <a class="dropdown-item" target="_blank" href="/cgi-bin/koha/svc/barcode?barcode=[% item.barcode | uri %]" >Show barcode</a>
+ </li>
  [% UNLESS item.nomod %]
  <li>
  <form id="[% item.itemnumber | html %]-delete-item-form" action="/cgi-bin/koha/cataloguing/additem.pl" method="post">