Bug 10305

Summary: _increment_barcode is called twice
Product: Koha Reporter: Kyle M Hall <kyle.m.hall>
Component: Architecture, internals, and plumbingAssignee: Kyle M Hall <kyle.m.hall>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: trivial    
Priority: P5 - low CC: gmcharlt, kyle, m.de.rooy, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 10305 - Duplicate code in Search.pm
Bug 10305 - _increment_barcode is called twice
Bug 10305 - _increment_barcode is called twice

Description Kyle M Hall 2013-05-21 19:58:38 UTC
For some reason, _increment_barcode is called twice in succession in cataloguing/additem.pl
Comment 1 Kyle M Hall (khall) 2013-05-21 20:00:36 UTC Comment hidden (obsolete)
Comment 2 Galen Charlton 2013-05-22 00:23:12 UTC
The patch itself looks OK, the patch title is clearly wrong.  Please update the patch title (and the bug title) to reflect the actual problem, which is that _increment_barcode is called twice.
Comment 3 Kyle M Hall (khall) 2013-08-09 13:25:26 UTC Comment hidden (obsolete)
Comment 4 Marcel de Rooy 2013-09-23 12:31:46 UTC
Created attachment 21370 [details] [review]
Bug 10305 - _increment_barcode is called twice

For some reason, _increment_barcode is called twice in succession in
cataloguing/additem.pl

Test Plan:
1) Enable autobarcode = incremental
2) Catalog an item, not the barcode
3) Apply this patch
4) Catalog another item, the barcode should be the next in line
   as previously. No change should be noted.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2013-09-23 12:37:26 UTC
Works. Looks good to me. There was no problem before, just a duplicate executing of a select max in the database.

Note that the code used for this increment might still be wrong with concurrent edits, since the max calculation and the update of the table are quite separate parts in code. Reminds me of the discussion about the seqno engine..

No complaints from qa tools.

Passed QA
Comment 6 Galen Charlton 2013-09-23 16:06:29 UTC
Pushed to master.  Thanks, Kyle!
Comment 7 Tomás Cohen Arazi (tcohen) 2013-11-13 16:23:31 UTC
This patch has been pushed to 3.12.x, will be in 3.12.7.

Thanks Kyle!