Koha-clms/cataloguing
Martin Renvoize 21ce3d18c9
Bug 42221: Fix EAN-13 autoBarcode not incrementing
The EAN-13 barcode query used max(abs(barcode)) which allowed non-EAN-13
barcodes (e.g. 14-digit KTD sample barcodes) to dominate the result.
The saved 13-digit EAN-13 barcodes were always smaller, so $nextnum
never advanced and the same barcode was generated on every page load.

Fix by extracting EAN-13 logic into C4::Barcodes::ValueBuilder::EAN13
(consistent with other barcode type packages) and scoping the query to
WHERE length(barcode) = 13 so only valid-length barcodes contribute to
the max. Both barcode.pl and Koha::REST::V1::Biblios now call the shared
function, eliminating the duplicated inline code.

Tests: adds EAN-13 test cases to t/db_dependent/Barcodes_ValueBuilder.t
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit fc6e5839d4)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
2026-05-24 13:42:19 +01:00
..
value_builder Bug 42221: Fix EAN-13 autoBarcode not incrementing 2026-05-24 13:42:19 +01:00
addbiblio.pl Bug 40272: (QA follow-up) Only add a biblio test 2025-10-16 15:20:20 -06:00
addbooks.pl Bug 41989: Call getlanguage after get_template_and_user 2026-04-14 09:21:43 +01:00
additem.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
cataloging-home.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
concerns.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
editor.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
linkitem.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
merge.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
merge_ajax.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
moveitem.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
plugin_launcher.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ysearch.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
z3950_auth_search.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
z3950_search.pl Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00