Bug 23851

Summary: Auto generate accession number format <branchcode>yymm0001 fails to add branchcode prefix(branchcode) for multiple item addition
Product: Koha Reporter: Abhi <abhishekv>
Component: CatalogingAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to stable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: abhishekv, fridolin.somers, hagud, isabel.pineda, jonathan.druart, katrin.fischer, m.de.rooy, nengard, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.05
Attachments: Multiple items added in the catalog, with branchcode missing from barcode prefix
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items

Description Abhi 2019-10-21 10:32:33 UTC
Created attachment 94430 [details]
Multiple items added in the catalog, with branchcode missing from barcode prefix

When selected autoBarcode format to <branchcode>yymm0001 and trying to add multiple items from the item addition form the items get added but the barcode (p - Accession Number) field does not contain branch code prefix and only the 0001 segment gets incremented.

This is in case if branchcode is in Char format eg. <BLR>yymm0001
Comment 1 Jonathan Druart 2019-10-22 09:24:58 UTC
Lowering severity.
Comment 2 Jonathan Druart 2019-10-22 09:40:27 UTC
Created attachment 94519 [details] [review]
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items

See the comment in the code for more information.

Test plan:
- Set autoBarcode to hbyymmincr
- Create an item and click on the barcode field
- A barcode prefixed by the homebranch is generated
- Click the "Add multiple copies of this item" and enter 4
- Save
=> Without this patch only the first item has the homebranch prefix
=> With this patch applied they all have a barcode in the same format
Comment 3 Katrin Fischer 2019-11-02 21:29:06 UTC
*** Bug 23270 has been marked as a duplicate of this bug. ***
Comment 4 Katrin Fischer 2019-11-02 21:48:38 UTC
*** Bug 4175 has been marked as a duplicate of this bug. ***
Comment 5 Katrin Fischer 2019-11-02 21:49:12 UTC
Created attachment 94974 [details] [review]
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items

See the comment in the code for more information.

Test plan:
- Set autoBarcode to hbyymmincr
- Create an item and click on the barcode field
- A barcode prefixed by the homebranch is generated
- Click the "Add multiple copies of this item" and enter 4
- Save
=> Without this patch only the first item has the homebranch prefix
=> With this patch applied they all have a barcode in the same format

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2019-11-02 21:49:31 UTC
3 bugs for the price of one sign-off... a good deal I'd say :)
Comment 7 Katrin Fischer 2019-11-02 21:56:18 UTC
*** Bug 15239 has been marked as a duplicate of this bug. ***
Comment 8 Marcel de Rooy 2019-11-08 11:27:43 UTC
Created attachment 95208 [details] [review]
Bug 23851: Add the homebranch prefix to the barcode when adding multiple copies of an items

See the comment in the code for more information.

Test plan:
- Set autoBarcode to hbyymmincr
- Create an item and click on the barcode field
- A barcode prefixed by the homebranch is generated
- Click the "Add multiple copies of this item" and enter 4
- Save
=> Without this patch only the first item has the homebranch prefix
=> With this patch applied they all have a barcode in the same format

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Marcel de Rooy 2019-11-08 11:28:09 UTC
(In reply to Katrin Fischer from comment #6)
> 3 bugs for the price of one sign-off... a good deal I'd say :)

No good deal, this is horrible code ;)
Comment 10 Martin Renvoize 2019-11-08 12:56:59 UTC
Nice work!

Pushed to master for 19.11.00
Comment 11 Tomás Cohen Arazi 2019-11-08 18:28:49 UTC
Thanks for this fix! It is present in 18.11 also.
Comment 12 Fridolin SOMERS 2019-11-15 10:24:12 UTC
Pushed to 19.05.x for 19.05.05

# This is terribly hacky :'(