Koha-clms/C4
David Cook e06e3d8ec9
Bug 40473: Use better algorithm for calculating Code39 barcode length
This patch uses the PDF::Reuse::Barcode algorithm for calculating barcode
background box length relative to barcode length in order to determine
the actual barcode width and thus the X scale factor required to re-size
that barcode so that it fits on the label width (or rather the
"Barcode width" which is a percentage applied to the label width
to create a narrower usable surface for the barcode and barcode background
box).

To test:
0. Apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=29
2. Add an item with barcode 123456, add an item with barcode 39999000001310399991,
    and ensure an item with barcode 39999000001310 already exists
3. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=batch
4. Create a patch that uses 3 items using 39999000001310, 2 items with 123456,
    and 2 items with 39999000001310399991
4. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=layout
5. Edit the layout "Label Test"
6. Change the "Barcode width" to 1, and enable "Draw guide boxes", and click "Save"
7. Export the batch using the template "Avery 5160 | 1 x 2-5/8" and the layout "Label Test" and open as PDF
8. Note that the whole barcode fits inside the red guidebox (there should be some
overlap of white on top of the red guidebox but that is normal since we're using 100% of the
barcode label width).
9. Edit the "Label Test" layout to try "Code39 + Modulo43" and "Code39 + Modulo10" and retry batch export
10. Edit the "Label Test" and try different "Barcode width" like the usual default .8
11. Celebrate that your barcodes fit on the label!

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9da5f23f96)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-10-23 23:06:36 +02:00
..
AuthoritiesMarc Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Barcodes Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
ClassSortRoutine Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSplitRoutine Bug 40388: Remove warning from t/Labels.t 2025-07-24 10:23:31 +02:00
Creators Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
External Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Form Bug 34776: Add unit tests for sub restore_form_values 2025-07-10 22:47:22 +02:00
Heading Bug 39415: (follow-up) Add 651g to bib heading fields as well 2025-05-06 18:48:18 +02:00
ILSDI Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Installer Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
Labels Bug 40473: Use better algorithm for calculating Code39 barcode length 2025-10-23 23:06:36 +02:00
Linker Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
Members Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
OAI Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Output Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
Patroncards Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
Reports Bug 39325: Manual fixes 2025-04-28 18:51:23 +02:00
SIP Bug 40675: Fix SIP message corruption from embedded line endings 2025-09-25 16:22:51 +02:00
Search Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
Serials Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Utils/DataTables Bug 39427: Searching lists table by owner can only enter firstname or surname 2025-08-22 09:48:26 +02:00
Accounts.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Acquisition.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Auth.pm Bug 40275: Use Koha::Patrons->find_by_identifier in the codebase 2025-09-20 10:43:37 +02:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-08 13:16:36 +00:00
Auth_with_cas.pm Bug 40275: Use Koha::Patrons->find_by_identifier in the codebase 2025-09-20 10:43:37 +02:00
Auth_with_ldap.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Auth_with_shibboleth.pm Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
AuthoritiesMarc.pm Bug 40119: (QA follow-up) Small additional comment 2025-06-22 23:48:48 +02:00
Barcodes.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Biblio.pm Bug 38619: UNIMARC prices should also be extracted from 071d 2025-09-20 10:42:36 +02:00
Breeding.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Budgets.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Calendar.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Charset.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Circulation.pm Bug 40708: Return the specific error to the checkin page 2025-09-25 16:22:48 +02:00
ClassSortRoutine.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSource.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ClassSplitRoutine.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Context.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Contract.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
CourseReserves.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
Creators.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
HTML5Media.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Heading.pm Bug 38729: Linker should consider diacritics 2025-04-14 08:50:57 +02:00
HoldsQueue.pm Bug 40620: Holds Queue will assign to the lowest item number if multiple branches have the same transport cost 2025-08-26 20:37:29 +02:00
ImportBatch.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
ImportExportFramework.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
InstallAuth.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Installer.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
ItemCirculationAlertPreference.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
Items.pm Bug 23010: Handle error in C4/Items.pm using try/catch 2025-09-16 14:02:05 +02:00
Koha.pm Bug 40277: Remove warn in C4::Koha::GetAuthorisedValues() 2025-07-10 22:47:31 +02:00
Labels.pm Bug 21395: Make perlcritic happy 2020-06-29 12:37:02 +02:00
Languages.pm Bug 39325: Tidy 2025-04-28 18:51:27 +02:00
Letters.pm Bug 38997: Remove outdated developer doc 2025-09-20 10:42:37 +02:00
Linker.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
Log.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
MarcModificationTemplates.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Matcher.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Members.pm Bug 37418: delete_patrons.pl: Exclude patrons with restrictions 2025-04-25 08:46:53 +02:00
Message.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
Output.pm Bug 39367: Manual changes 2025-04-23 09:35:15 +02:00
Overdues.pm Bug 39405: (follow-up) Add the parameter borrowernumber to the overwrite_calc_fine plugin hook 2025-04-25 08:46:49 +02:00
Patroncards.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Record.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Reports.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Reserves.pm Bug 40636: (follow-up) Cache the calendar object 2025-09-20 10:43:50 +02:00
Ris.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
RotatingCollections.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
SMS.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Scheduler.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Scrubber.pm Bug 40079: (follow-up) Improve test coverage and fix undef handling 2025-07-10 22:47:17 +02:00
Search.pm Bug 37883: (follow-up) Increment counts correctly 2025-09-16 14:02:21 +02:00
Serials.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Service.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
ShelfBrowser.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
SocialData.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Stats.pm Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
Suggestions.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
TTParser.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
Tags.pm Bug 39834: Replace some tabs with spaces 2025-06-17 21:42:59 +02:00
Templates.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
TmplToken.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
TmplTokenType.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
UsageStats.pm Bug 39325: Automatic fix 2025-04-28 18:51:22 +02:00
XISBN.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00
XSLT.pm Bug 39367: Automatic changes 2025-04-23 09:35:14 +02:00