Koha-clms/C4/Barcodes
Martin Renvoize fc6e5839d4
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>
2026-04-16 15:54:09 -06:00
..
EAN13.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ValueBuilder.pm Bug 42221: Fix EAN-13 autoBarcode not incrementing 2026-04-16 15:54:09 -06:00
annual.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
hbyymmincr.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
incremental.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00