From 0811d668ee33aece1c86bebd171d04e012ae8b58 Mon Sep 17 00:00:00 2001 From: Alex Arnaud <alex.arnaud@biblibre.com> Date: Wed, 6 Apr 2011 16:49:53 +0200 Subject: [PATCH] Bug #6093 - Correct the query to find the greater barcode in database --- cataloguing/value_builder/barcode.pl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cataloguing/value_builder/barcode.pl b/cataloguing/value_builder/barcode.pl index 3c6ef74..9987a27 100755 --- a/cataloguing/value_builder/barcode.pl +++ b/cataloguing/value_builder/barcode.pl @@ -99,7 +99,7 @@ sub plugin_javascript { } elsif ($autoBarcodeType eq 'hbyymmincr') { # Generates a barcode where hb = home branch Code, yymm = year/month catalogued, incr = incremental number, reset yearly -fbcit $year = substr($year, -2); - $query = "SELECT MAX(CAST(SUBSTRING(barcode,7,4) AS signed)) FROM items WHERE barcode REGEXP ?"; + $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) FROM items WHERE barcode REGEXP ?"; my $sth = $dbh->prepare($query); $sth->execute("^[a-zA-Z]{1,}$year"); while (my ($count)= $sth->fetchrow_array) { -- 1.6.3.3