Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. my $prefix = $yaml->{$branchcode} || '666';
  2.  
  3. $query = "SELECT MAX(CAST(SUBSTRING(barcode,-4) AS signed)) from items where barcode REGEXP ?";
  4. $sth=C4::Context->dbh->prepare($query);
  5. $sth->execute("^$prefix$args->{year}$args->{mon}");
  6.  
  7. while (my ($count)= $sth->fetchrow_array) {
  8. warn "Examining Record: $count" if $DEBUG;
  9. $nextnum = $count if $count;
  10. }
  11.  
  12. $nextnum++;
  13. $nextnum = sprintf("%0*d", "5",$nextnum);
  14.  
  15. $barcode = $prefix;
  16. $barcode .= $args->{year}.$args->{mon}.$nextnum;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement