[Koha-patches] [PATCH] Bug #6093 - Correct the query to find the greater barcode in database

Alex Arnaud alex.arnaud at biblibre.com
Wed Apr 6 16:51:11 CEST 2011


---
 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



More information about the Koha-patches mailing list