Bug 2555 : label batch_id not properly incremented after batch num 10.

This is a stop-gap fix intended for 3.0 maintenance release.
3.2 should include a label_batches table which will allow named
batches to be associated with a template & layout, and fix the
column definition of batch_id here to be an auto_incr int.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Ryan Higgins 2008-09-27 12:57:08 -05:00 committed by Galen Charlton
parent 5e963f0fc3
commit 1bbe1ea268
1 changed files with 3 additions and 1 deletions

View File

@ -275,7 +275,9 @@ sub add_batch ($;$) {
my $table = (@_ and 'patroncards' eq shift) ? 'patroncards' : 'labels';
my $batch_list = (@_) ? shift : undef;
my $dbh = C4::Context->dbh;
my $q ="SELECT MAX(DISTINCT batch_id) FROM $table";
# FIXME : batch_id should be an auto_incr INT. Temporarily casting as int ( see koha bug 2555 )
# until a label_batches table is added, and we can convert batch_id to int.
my $q ="SELECT MAX( CAST(batch_id AS SIGNED) ) FROM $table";
my $sth = $dbh->prepare($q);
$sth->execute();
my ($batch_id) = $sth->fetchrow_array || 0;