[Bug 44311] New: hbyymmincr autoBarcode shares one 9999 sequence between all libraries
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 Bug ID: 44311 Summary: hbyymmincr autoBarcode shares one 9999 sequence between all libraries Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Target Milestone: --- When autoBarcode is set to "generated in the form <branchcode>yymm0001" (hbyymmincr), the next sequence number is the highest number used by any library in that month. All libraries share one sequence, so the whole consortium is limited to 9999 items a month, and a busy library uses up the numbers for every other library. When the sequence reaches 9999 it starts again at 0001, which returns a barcode that already exists, so the item cannot be saved. The barcode value builder also returns JavaScript from C4::Barcodes::ValueBuilder::hbyymmincr::get_barcode, unlike the other barcode types, and the REST API (POST /api/v1/biblios/{biblio_id}/items) builds its own barcode from an unpadded month, so in January to September it generates barcodes in a different format (for example CPL2610001). The sequence should be kept for each library, the REST API should use the same code as the staff interface, and a library that has used all of its numbers should get no generated barcode instead of a duplicate. Test plan: 1. Set the autoBarcode system preference to "generated in the form <branchcode>yymm0001". 2. Add an item to a record, choosing Centerville (CPL) as the home library, and click in the barcode field (952$p). Note the barcode, for example CPL26110001, and save the item. 3. Add another item and choose Fairview (FFL) as the home library. Click in the barcode field. => The barcode is FFL26110001. The CPL items do not affect the FFL sequence. 4. Change the home library back to CPL, clear the barcode field and click in it again. => The barcode is CPL26110002. 5. Add several items at once with the same home library. => Each item gets a different barcode. 6. Set the barcode of a CPL item to CPL26119999 and try to add another CPL item. => The barcode field is left empty and a warning is logged. Depends on bug 44309. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 212728 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212728&action=edit Bug 44311: Keep a separate hbyymmincr barcode sequence for each library hbyymmincr::get_barcode took the highest sequence number used by any library in the month, so all libraries together were limited to 9999 items a month. It now takes the library code and only looks at that library's barcodes, which also lets it use one anchored LIKE instead of one per library. It returns the complete barcode (for example CPL26110001) rather than the number without the library prefix, and no longer returns JavaScript. When a library has used all 9999 numbers it now returns undef and logs a warning, instead of starting again at 0001 and returning a barcode that already exists. To test: 1. prove t/db_dependent/Barcodes_ValueBuilder.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 212729 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212729&action=edit Bug 44311: Add C4::Barcodes::ValueBuilder::next_barcode and use it when adding items over the API Adding an item over the API repeated the choice of autoBarcode type, and got the hbyymmincr month wrong for January to September, because the month was not zero padded. The barcode would not have matched the format used elsewhere. next_barcode() makes that choice in one place, takes the library for hbyymmincr, and returns nothing if autoBarcode is OFF, unknown, or has no barcode left. To test: 1. prove t/db_dependent/Barcodes_ValueBuilder.t t/db_dependent/api/v1/biblios.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 212730 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212730&action=edit Bug 44311: Fetch the hbyymmincr barcode for the chosen home library from the API The barcode value builder worked out the hbyymmincr number when the form loaded, for no library in particular, and the JavaScript put the library chosen in the form in front of it. Now the sequence is kept for each library, so the number depends on the library chosen at the time the barcode field is used. Add GET /api/v1/libraries/{library_id}/next_barcode and have the JavaScript ask it for the next barcode of the item's current home library. Barcodes handed out on the same page for one library are counted so that several new items do not get the same barcode. To test: 1. Set autoBarcode to "generated in the form <branchcode>yymm0001". 2. Add an item to a record, choosing Centerville (CPL) as home library, and click in the barcode field. => The barcode is CPL<yymm>0001 (or the next free number). 3. Change the home library to another library and clear the barcode field, then click in it again. => The barcode starts with the other library code and has its own sequence. 4. Add several items at once. => Each barcode is different. 5. prove t/db_dependent/api/v1/libraries.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk Status|NEW |Needs Signoff Depends on| |44309 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44309 [Bug 44309] hbyymmincr autoBarcode counts unrelated numeric barcodes and repeats 0001 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #212728|0 |1 is obsolete| | Attachment #212729|0 |1 is obsolete| | Attachment #212730|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 212737 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212737&action=edit Bug 44311: Keep a separate hbyymmincr barcode sequence for each library hbyymmincr::get_barcode took the highest sequence number used by any library in the month, so all libraries together were limited to 9999 items a month. It now takes the library code and only looks at that library's barcodes, which also lets it use one anchored LIKE instead of one per library. It returns the complete barcode (for example CPL26110001) rather than the number without the library prefix, and no longer returns JavaScript. When a library has used all 9999 numbers it now returns undef and logs a warning, instead of starting again at 0001 and returning a barcode that already exists. To test: 1. prove t/db_dependent/Barcodes_ValueBuilder.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 212738 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212738&action=edit Bug 44311: Add C4::Barcodes::ValueBuilder::next_barcode and use it when adding items over the API Adding an item over the API repeated the choice of autoBarcode type, and got the hbyymmincr month wrong for January to September, because the month was not zero padded. The barcode would not have matched the format used elsewhere. next_barcode() makes that choice in one place, takes the library for hbyymmincr, and returns nothing if autoBarcode is OFF, unknown, or has no barcode left. To test: 1. prove t/db_dependent/Barcodes_ValueBuilder.t t/db_dependent/api/v1/biblios.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 212739 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212739&action=edit Bug 44311: Fetch the hbyymmincr barcode for the chosen home library from the API The barcode value builder worked out the hbyymmincr number when the form loaded, for no library in particular, and the JavaScript put the library chosen in the form in front of it. Now the sequence is kept for each library, so the number depends on the library chosen at the time the barcode field is used. Add GET /api/v1/libraries/{library_id}/next_barcode and have the JavaScript ask it for the next barcode of the item's current home library. Barcodes handed out on the same page for one library are counted so that several new items do not get the same barcode. To test: 1. Set autoBarcode to "generated in the form <branchcode>yymm0001". 2. Add an item to a record, choosing Centerville (CPL) as home library, and click in the barcode field. => The barcode is CPL<yymm>0001 (or the next free number). 3. Change the home library to another library and clear the barcode field, then click in it again. => The barcode starts with the other library code and has its own sequence. 4. Add several items at once. => Each barcode is different. 5. prove t/db_dependent/api/v1/libraries.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernard.scaife@openfifth.co | |.uk, | |jacob.omara@openfifth.co.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44311 --- Comment #7 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Interested in feedback on the api shape here. Thanks for the quick testing David :) -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org