From 997f27e801cc823f1f60a345d0411932e50f7853 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Thu, 27 Jun 2002 16:26:52 +0000 Subject: [PATCH] Re-enabling the max(barcode) + 1 behaviour. Checks that the last digit is a number before adding 1. If the last digit isn't a number, fall back to Roger's behaviour of using biblionumber as barcode. --- acqui.simple/addbooks.pl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/acqui.simple/addbooks.pl b/acqui.simple/addbooks.pl index 4c70a847b1..b61175713f 100755 --- a/acqui.simple/addbooks.pl +++ b/acqui.simple/addbooks.pl @@ -319,10 +319,16 @@ if ($isbn) { EOF } -# my $sth=$dbh->prepare("select max(barcode) from items"); -# $sth->execute; -# my ($maxbarcode) = $sth->fetchrow; -# $maxbarcode++; + my $sth=$dbh->prepare("select max(barcode) from items"); + $sth->execute; + my ($maxbarcode) = $sth->fetchrow; + if ($maxbarcode=~/\d$/) { + # maxbarcode ends in a digit + $maxbarcode++; + } else { + $maxbarcode=$biblionumber; + } + $maxbarcode++; # print STDERR "MaxBarcode: $maxbarcode \n"; print << "EOF";
@@ -332,8 +338,8 @@ EOF - -
BARCODE +
BARCODE + Home Branch: