Bug 21937 - Syspref autoBarcode annual doesn't increment properly barcode in some cases
Summary: Syspref autoBarcode annual doesn't increment properly barcode in some cases
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Frédéric Demians
QA Contact: Martin Renvoize
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-03 20:57 UTC by Frédéric Demians
Modified: 2020-06-04 20:32 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.05.00, 18.11.05


Attachments
Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode in some cases (1.08 KB, patch)
2018-12-03 21:01 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 21937: syspref autoBarcode annual doesn't increment properly barcode (2.05 KB, patch)
2018-12-03 21:03 UTC, Frédéric Demians
Details | Diff | Splinter Review
Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode in some cases (1.18 KB, patch)
2019-04-14 18:53 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 21937: syspref autoBarcode annual doesn't increment properly barcode (2.16 KB, patch)
2019-04-14 18:53 UTC, Michal Denar
Details | Diff | Splinter Review
Bug 21937: Add test to show autoBarcode annual increment bug (1.17 KB, patch)
2019-04-17 10:39 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode (2.17 KB, patch)
2019-04-17 10:39 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Frédéric Demians 2018-12-03 20:57:33 UTC
When autoBarcode is set to 'annual', and there is an existing barcode beginning with the 4 digit of the current year, the auto generated barcode may be wrong.

For example, you have this barcode '20184526546'. If you ask for the next 2018-000X barcode, you will 20184526547
Comment 1 Frédéric Demians 2018-12-03 21:01:50 UTC
Created attachment 82828 [details] [review]
Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode in some cases

This patch show the issue. If the DB contains a barcode (not auto attributed
by Koha) which begin with the year used to generate automatically a new one,
there may be a 'collision'.

prove -v t/db_dependent/Barcodes_ValueBuilder.t
Comment 2 Frédéric Demians 2018-12-03 21:03:04 UTC
Created attachment 82829 [details] [review]
Bug 21937: syspref autoBarcode annual doesn't increment properly barcode

This patch fix the barcode annual builder. The test wil work.
Comment 3 Michal Denar 2019-04-14 18:53:19 UTC
Created attachment 87953 [details] [review]
Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode in some cases

This patch show the issue. If the DB contains a barcode (not auto attributed
by Koha) which begin with the year used to generate automatically a new one,
there may be a 'collision'.

prove -v t/db_dependent/Barcodes_ValueBuilder.t

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 4 Michal Denar 2019-04-14 18:53:22 UTC
Created attachment 87954 [details] [review]
Bug 21937: syspref autoBarcode annual doesn't increment properly barcode

This patch fix the barcode annual builder. The test wil work.

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 5 Martin Renvoize 2019-04-17 10:39:51 UTC
Created attachment 88162 [details] [review]
Bug 21937: Add test to show autoBarcode annual increment bug

This patch show the issue. If the DB contains a barcode (not auto attributed
by Koha) which begin with the year used to generate automatically a new one,
there may be a 'collision'.

prove -v t/db_dependent/Barcodes_ValueBuilder.t

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2019-04-17 10:39:54 UTC
Created attachment 88163 [details] [review]
Bug 21937: Syspref autoBarcode annual doesn't increment properly barcode

This patch fix the barcode annual builder. The test should pass.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2019-04-17 10:40:38 UTC
No regressions found, QA scripts pass and patches make sense.

Passing QA
Comment 8 Nick Clemens 2019-04-19 14:54:41 UTC
Awesome work all!

Pushed to master for 19.05
Comment 9 Martin Renvoize 2019-04-26 14:33:43 UTC
Pushed to 18.11.x for 18.11.05
Comment 10 Lucas Gass 2019-05-14 21:37:56 UTC
backported t0 18.05.x for 18.05.13