Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my $prefix = $yaml->{$branchcode} || '666';
- $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) from items where barcode REGEXP ?";
- $sth=C4::Context->dbh->prepare($query);
- $sth->execute("^$prefix$args->{year}$args->{mon}");
- while (my ($count)= $sth->fetchrow_array) {
- warn "Examining Record: $count" if $DEBUG;
- $nextnum = $count if $count;
- }
- $nextnum++;
- $nextnum = sprintf("%0*d", "5",$nextnum);
- $barcode = $prefix;
- $barcode .= $args->{year}.$args->{mon}.$nextnum;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement