Bug 15877 - C4::Barcodes does not correctly calculate db_max for 'annual' barcodes
This patch alters the MySQL query to remove a max statement which
incorrectly groups full annual barcodes with numeric values.
Signed-off-by: Srdjan <srdjan@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
(cherry picked from commit a3557fd0f2)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
parent
3d7f6832bc
commit
befbae8469
|
|
@ -39,8 +39,8 @@ BEGIN {
|
|||
|
||||
sub db_max ($;$) {
|
||||
my $self = shift;
|
||||
my $query = "SELECT max(substring_index(barcode,'-',-1)) AS chunk,barcode FROM items WHERE barcode LIKE ? GROUP BY barcode";
|
||||
# FIXME: unreasonably expensive query on large datasets
|
||||
my $query = "SELECT substring_index(barcode,'-',-1) AS chunk,barcode FROM items WHERE barcode LIKE ? ORDER BY chunk DESC LIMIT 1";
|
||||
# FIXME: unreasonably expensive query on large datasets (I think removal of group by does this?)
|
||||
my $sth = C4::Context->dbh->prepare($query);
|
||||
my ($iso);
|
||||
if (@_) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue