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.