]> git.koha-community.org Git - koha.git/commit
Bug 26328: Cast barcode from varchar to integer for incremental barcode
authorDavid Cook <dcook@prosentient.com.au>
Fri, 4 Dec 2020 05:36:04 +0000 (05:36 +0000)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Sun, 17 Apr 2022 20:19:24 +0000 (22:19 +0200)
commit9bb65ebc5d84adea9bd046390da1c5eb13de3bb8
tree00a58013491e0d2f46b5ec9545811a6b6814b9f6
parent08a0e5925b47246104559e9145596e7a45eddd36
Bug 26328: Cast barcode from varchar to integer for incremental barcode

Without this patch, the incremental barcode generation will
treat 978e0143019375 as having an exponent and interpret it as a very
large number.

With this patch, the incremental barcode generation will first cast
barcode varchar strings to integers before finding a max() value.
In this case 978e0143019375 becomes 978 instead of
1.7976931348623157e308

Test plan:

0. Using koha-testing-docker

Before applying patch:

1. Go to http://localhost:8081/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=autobarcode
2. Set to "generated in the form 1, 2, 3"
3. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
4. Add item with barcode 978e0143019375
5. Click "p - Barcode"
6. Note the barcode is "Inf"

After applying patch:
1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additema&searchid=scs_1607059974968
2. Click "p - Barcode"
3. Note the barcode is "39999000019194"

Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 445cbb373bc7756494a4b28cede53ec23942999e)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 1b5cb40fbcc769a7cf0355a46d3d13e2a00deb0f)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
C4/Barcodes/ValueBuilder.pm