Koha-clms/C4
David Cook 17abd3d8d0
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>
(cherry picked from commit e06e3d8ec9)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
2025-10-31 14:33:47 +00:00
..
AuthoritiesMarc Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Barcodes Bug 19113: Barcode value builder not working with numeric branchcode 2025-07-31 10:27:42 +02:00
ClassSortRoutine Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ClassSplitRoutine Bug 40388: Remove warning from t/Labels.t 2025-08-01 14:29:57 +02:00
Creators Bug 37720: Prevent XSS in label creator 2024-10-18 12:07:51 +02:00
External Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Form Bug 34776: Add unit tests for sub restore_form_values 2025-07-28 10:22:07 +02:00
Heading Bug 39415: (follow-up) Add 651g to bib heading fields as well 2025-05-26 20:17:03 +02:00
ILSDI Bug 31224: Update instances of metadata->record 2024-11-07 16:29:23 +01:00
Installer Bug 30731: Remove Readonly::XS::MAGIC_COOKIE 2022-06-01 16:15:26 -03:00
Labels Bug 40473: Use better algorithm for calculating Code39 barcode length 2025-10-31 14:33:47 +00:00
Linker Bug 35125: Respect LinkerConsiderThesaurus in update_cache 2024-07-01 18:55:42 +02:00
Members Bug 29194: Create logical ordering of patron messaging preferences 2024-10-11 11:13:56 +02:00
OAI Bug 30308: Fix bulkmarcimport.pl broken by OAI-PMH:AutoUpdateSets(EmbedItemData) 2022-07-29 15:43:39 -03:00
Output Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Patroncards Bug 39295: Prevent infinite loop on line wrapping 2025-06-19 11:06:57 +02:00
Reports Bug 37784: Do not show forbidden columns in reports dictionary 2025-03-24 17:59:09 +01:00
SIP Bug 40675: Fix SIP message corruption from embedded line endings 2025-10-16 11:51:51 +02:00
Search Bug 30718: Use flatpickr's altInput 2022-08-19 08:26:31 -03:00
Serials Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Utils/DataTables Bug 39427: Searching lists table by owner can only enter firstname or surname 2025-09-19 14:56:16 +02:00
Accounts.pm Bug 29184: Fix warn about undefined replacecost 2022-09-08 10:50:30 -07:00
Acquisition.pm Bug 38343: Do not show closed invoices by default when receiving 2024-11-22 10:22:39 +01:00
Auth.pm Bug 39734: Remove obsolete call of system preference IntranetmainUserblock 2025-09-29 11:02:01 +02:00
Auth_cas_servers.yaml.sample
…
Auth_with_cas.pm Bug 34893: (QA follow-up) Tidy code for qa script 2024-02-02 17:31:47 +01:00
Auth_with_ldap.pm Bug 36822: LDAP - Add discard_changes 2024-11-07 16:29:15 +01:00
Auth_with_shibboleth.pm Bug 36822: Shibboleth - Add discard_changes 2024-11-07 16:29:14 +01:00
AuthoritiesMarc.pm Bug 40119: (QA follow-up) Small additional comment 2025-07-25 14:28:18 +02:00
Barcodes.pm Bug 37070: (QA follow-up) Fix qa script issues 2024-10-18 14:26:05 +02:00
Biblio.pm Bug 38619: UNIMARC prices should also be extracted from 071d 2025-10-10 13:44:18 +02:00
Breeding.pm Bug 37546: Output error message from ZOOM in Z3950 errors 2025-10-06 16:24:34 +02:00
Budgets.pm Bug 31631: Optionally use tax-exclusive values for calculating fund values 2023-10-18 15:41:35 -03:00
Calendar.pm Bug 32048: Added clear cache routine to delete_holiday_range_repeatable 2023-09-18 15:31:50 -03:00
Charset.pm Bug 18984: Remove NORMARC support 2021-10-07 15:36:40 +02:00
Circulation.pm Bug 39735: Fix typo in system preference call 'OPACFineNoRenewalsIncludeCredit' 2025-09-29 11:19:13 +02:00
ClassSortRoutine.pm Bug 29951: Fix EXPORT for C4::ClassS*Routine modules 2022-07-08 15:29:56 -03:00
ClassSource.pm Bug 23387: Add caching to C4::ClassSource 2024-08-26 17:39:31 +02:00
ClassSplitRoutine.pm Bug 29951: Fix EXPORT for C4::ClassS*Routine modules 2022-07-08 15:29:56 -03:00
Context.pm Bug 36081: Use multivalue_preference 2025-02-24 20:43:20 +01:00
Contract.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CourseReserves.pm Bug 30016: Remove GetOpenIssue subroutine 2022-08-31 08:50:37 -03:00
Creators.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
HTML5Media.pm Bug 18984: Remove NORMARC support 2021-10-07 15:36:40 +02:00
Heading.pm Bug 38483: C4::Heading::preferred_authorities is not used 2025-03-24 18:12:14 +01:00
HoldsQueue.pm Bug 40620: Holds Queue will assign to the lowest item number if multiple branches have the same transport cost 2025-09-26 15:23:50 +02:00
ImportBatch.pm Bug 38279: Remove unused C4::ImportBatch::EmbedItemsInImportBiblio 2024-11-08 16:42:50 +01:00
ImportExportFramework.pm Bug 33339: Prevent Formula Injection (CSV Injection) in CSV files 2024-11-14 10:46:31 +01:00
InstallAuth.pm Bug 36367: Remove _new_userenv 2024-06-14 11:17:17 +01:00
Installer.pm Bug 38299: (follow-up) (discussion) Move failure into same level 2024-11-18 17:44:40 +01:00
ItemCirculationAlertPreference.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
Items.pm Bug 14907: Sort item search by cn_sort when sorting by callnumber 2025-04-22 23:01:31 +02:00
Koha.pm Bug 39603: Make sure authorised value category is ITEMTYPECAT 2025-09-29 11:09:45 +02:00
Labels.pm Bug 21395: Make perlcritic happy 2020-06-29 12:37:02 +02:00
Languages.pm Bug 38630: (QA follow-up) Fixing few calls of getTranslatedLanguages 2025-09-29 09:34:52 +02:00
Letters.pm Bug 36008: Use notice_email_address instead of email for SendAlerts issue type 2025-08-06 09:56:59 +00:00
Linker.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Log.pm Bug 37944: Log object delete as JSON diff, implement for items 2024-10-30 11:57:25 +01:00
MarcModificationTemplates.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Matcher.pm Bug 39070: Don't request facets when searching for recrod matches 2025-09-29 11:31:25 +02:00
Members.pm Bug 37845: Remove C4::Members::DeleteExpiredOpacRegistrations 2024-10-21 15:10:31 +02:00
Message.pm Bug 18398: (follow-up) Update POD & Unit tests 2023-03-31 13:13:35 +02:00
Output.pm Bug 34478: Remove check_csrf from pl files 2024-03-01 10:56:01 +01:00
Overdues.pm Bug 39405: (follow-up) Add the parameter borrowernumber to the overwrite_calc_fine plugin hook 2025-04-25 11:27:58 +02:00
Patroncards.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Record.pm Bug 14670: (QA follow-up) Tidy new code 2024-11-14 10:46:38 +01:00
Reports.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reserves.pm Bug 40034: Only check notforloan on itemtype if it exists 2025-07-09 14:58:38 +00:00
Ris.pm Bug 33431: Fix remaining cases 2024-03-18 11:03:39 +01:00
RotatingCollections.pm Bug 28294: Remove updateWrongTransfer 2024-11-07 18:49:36 +01:00
SMS.pm Bug 36051: (QA follow-up): Use yaml_preference 2024-04-12 11:26:12 +02:00
Scheduler.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Scrubber.pm Bug 40079: (follow-up) Improve test coverage and fix undef handling 2025-07-25 16:49:49 +02:00
Search.pm Bug 37004: Add branchcode as HTML class to each grouped result in search results 2024-09-02 12:13:42 +02:00
Serials.pm Bug 38829: Sanitize GetLateOrMissingIssues inputs 2025-02-18 19:17:17 +01:00
Service.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ShelfBrowser.pm Bug 29697: Replace GetMarcBiblio occurrences with $biblio->metadata->record 2022-07-22 15:24:11 -03:00
SocialData.pm Bug 33833: Add two FIXMEs to SocialData::get_report 2023-09-05 14:35:35 -03:00
Stats.pm Bug 33608: (QA follow-up) Remove ->insert method 2023-10-25 11:07:59 -03:00
Suggestions.pm Bug 38235: Suggestion confirmation letter sent when it should not 2024-11-12 17:50:18 +01:00
TTParser.pm Bug 36171: Fix template toolkit tags split by HTML parser 2024-10-24 13:38:12 +02:00
Tags.pm Bug 36785: Typo unreconized and bilbio in tags code 2024-05-17 10:36:35 +02:00
Templates.pm Bug 38467: Make uri and url filters rfc3986 when using C4::Template 2025-02-18 19:17:18 +01:00
TmplToken.pm
…
TmplTokenType.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
UsageStats.pm Bug 38104: Always update when hea cronjob is run 2025-04-22 23:02:27 +02:00
XISBN.pm Bug 30813: (QA follow-up) Adjust three use statements 2022-06-08 11:40:32 -03:00
XSLT.pm Bug 38100: (QA follow-up) Tidy changes in C4/XSLT.pm 2024-11-08 11:23:50 +01:00