Koha-clms/Koha/REST/V1
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
..
Acquisitions Bug 29668: Adapt to current guidelines 2026-02-16 14:45:31 +00:00
Auth Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Biblios Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
CashRegisters Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Clubs Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Config Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
ERM Bug 37622: Error in erm module when editing an agreement, a license, a package or a titles 2025-09-26 10:36:50 -06:00
ILL Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
OAuth Bug 34164: Redirect to referring URL when doing OIDC/OAuth SSO 2025-10-09 14:58:40 -06:00
Patrons Bug 41849: Add cancel hold_group REST API endpoint 2026-05-24 13:42:16 +01:00
Preservation Bug 37622: Remove location from 2 preservation 'update' routes 2025-09-26 10:36:53 -06:00
SIP2 Bug 37893: Fix http links 2025-11-18 11:21:20 -07:00
StockRotation Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AdditionalContents.pm Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
AdvancedEditorMacro.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ArticleRequests.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Auth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AuthorisedValueCategories.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
AuthorisedValues.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Authorities.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
BackgroundJobs.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Biblios.pm Bug 42221: Fix EAN-13 autoBarcode not incrementing 2026-05-24 13:42:19 +01:00
Bookings.pm Bug 40134: Implement optimal item selection for 'any item' bookings 2026-03-23 11:44:01 +00:00
Checkouts.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
CirculationRules.pm Bug 40163: (follow-up) Fix wrong GNU links and update test 2025-09-24 09:25:04 -06:00
Cities.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
DeletedBiblios.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ERM.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ExtendedAttributeTypes.pm Bug 38446: Add a dedicated route to retrieve ERM-related additional fields 2025-11-17 15:15:38 -07:00
Holds.pm Bug 41801: (QA follow-up) Ensure toggling priority sets correct rank 2026-05-24 13:42:12 +01:00
ImportBatchProfiles.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ImportRecordMatches.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
ItemTypes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Items.pm Bug 40154: prevent deletion of items with holds 2026-03-23 12:32:24 +00:00
Libraries.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Lists.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
OAuth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Patrons.pm Bug 41733: Honor EmailPatronRegistrations in the API 2026-05-24 13:42:18 +01:00
Preservation.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Quotes.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
RecordSources.pm Bug 35380: Change record sources to by systemdefined 2026-05-24 13:42:13 +01:00
ReturnClaims.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
SearchFilter.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Static.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Suggestions.pm Bug 41076: [25.11.x] Adjust perl tidiness for v20250105 2026-03-16 13:23:08 +00:00
Tickets.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TransferLimits.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TwoFactorAuth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00