[Koha-bugs] [Bug 15877] New: C4::Barcodes does not correctly calculate db_max for 'annual' barcodes
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Feb 22 14:12:38 CET 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15877
Bug ID: 15877
Summary: C4::Barcodes does not correctly calculate db_max for
'annual' barcodes
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Architecture, internals, and plumbing
Assignee: gmcharlt at gmail.com
Reporter: nick at bywatersolutions.com
QA Contact: testopia at bugs.koha-community.org
The SQL query to find the database max value for annual barcodes is:
42 my $query = "SELECT max(substring_index(barcode,'-',-1)) AS
chunk,barcode FROM items WHERE barcode LIKE ? GROUP BY barcode";
43 # FIXME: unreasonably expensive query on large datasets
The 'max' in the first column creates confusion and disrupts the normal pairing
of the db.
To recreate:
1 - Add two 'annual' type barcodes to the system (2016-0003, 2016-0006)
2 - Run the query:
SELECT max(substring_index(barcode,'-',-1)) AS chunk,barcode FROM items WHERE
barcode LIKE '2016-%' GROUP BY barcode
3 - Note that returned values may not pair up, in my case I got things like:
chunk | barcode
0006 | 2016-0003
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list