|
Lines 54-60
sub initial {
Link Here
|
| 54 |
return '0000001'; |
54 |
return '0000001'; |
| 55 |
} |
55 |
} |
| 56 |
sub width { |
56 |
sub width { |
| 57 |
return undef; |
57 |
return; |
| 58 |
} |
58 |
} |
| 59 |
sub process_head { # (self,head,whole,specific) |
59 |
sub process_head { # (self,head,whole,specific) |
| 60 |
my $self = shift; |
60 |
my $self = shift; |
|
Lines 128-134
sub next_value {
Link Here
|
| 128 |
my ($head,$incr,$tail) = $self->parse($max); # for incremental, you'd get ('',the_whole_barcode,'') |
128 |
my ($head,$incr,$tail) = $self->parse($max); # for incremental, you'd get ('',the_whole_barcode,'') |
| 129 |
unless (defined $incr) { |
129 |
unless (defined $incr) { |
| 130 |
warn "No incrementing part of barcode ($max) returned by parse."; |
130 |
warn "No incrementing part of barcode ($max) returned by parse."; |
| 131 |
return undef; |
131 |
return; |
| 132 |
} |
132 |
} |
| 133 |
my $x = length($incr); # number of digits |
133 |
my $x = length($incr); # number of digits |
| 134 |
$incr =~ /^9+$/ and $x++; # if they're all 9's, we need an extra. |
134 |
$incr =~ /^9+$/ and $x++; # if they're all 9's, we need an extra. |
|
Lines 144-160
sub next_value {
Link Here
|
| 144 |
return $next_value; |
144 |
return $next_value; |
| 145 |
} |
145 |
} |
| 146 |
sub next { |
146 |
sub next { |
| 147 |
my $self = shift or return undef; |
147 |
my $self = shift or return; |
| 148 |
(@_) and $self->{next} = shift; |
148 |
(@_) and $self->{next} = shift; |
| 149 |
return $self->{next}; |
149 |
return $self->{next}; |
| 150 |
} |
150 |
} |
| 151 |
sub previous { |
151 |
sub previous { |
| 152 |
my $self = shift or return undef; |
152 |
my $self = shift or return; |
| 153 |
(@_) and $self->{previous} = shift; |
153 |
(@_) and $self->{previous} = shift; |
| 154 |
return $self->{previous}; |
154 |
return $self->{previous}; |
| 155 |
} |
155 |
} |
| 156 |
sub serial { |
156 |
sub serial { |
| 157 |
my $self = shift or return undef; |
157 |
my $self = shift or return; |
| 158 |
(@_) and $self->{serial} = shift; |
158 |
(@_) and $self->{serial} = shift; |
| 159 |
return $self->{serial}; |
159 |
return $self->{serial}; |
| 160 |
} |
160 |
} |
|
Lines 190-200
sub new {
Link Here
|
| 190 |
$autoBarcodeType =~ s/^.*:://; # in case we get C4::Barcodes::incremental, we just want 'incremental' |
190 |
$autoBarcodeType =~ s/^.*:://; # in case we get C4::Barcodes::incremental, we just want 'incremental' |
| 191 |
unless ($autoBarcodeType) { |
191 |
unless ($autoBarcodeType) { |
| 192 |
carp "No autoBarcode format found."; |
192 |
carp "No autoBarcode format found."; |
| 193 |
return undef; |
193 |
return; |
| 194 |
} |
194 |
} |
| 195 |
unless (defined $types->{$autoBarcodeType}) { |
195 |
unless (defined $types->{$autoBarcodeType}) { |
| 196 |
carp "The autoBarcode format '$autoBarcodeType' is unrecognized."; |
196 |
carp "The autoBarcode format '$autoBarcodeType' is unrecognized."; |
| 197 |
return undef; |
197 |
return; |
| 198 |
} |
198 |
} |
| 199 |
carp "autoBarcode format = $autoBarcodeType" if $debug; |
199 |
carp "autoBarcode format = $autoBarcodeType" if $debug; |
| 200 |
my $self; |
200 |
my $self; |
|
Lines 225-231
sub new {
Link Here
|
| 225 |
return $self; |
225 |
return $self; |
| 226 |
} |
226 |
} |
| 227 |
carp "Failed new C4::Barcodes::$autoBarcodeType"; |
227 |
carp "Failed new C4::Barcodes::$autoBarcodeType"; |
| 228 |
return undef; |
228 |
return; |
| 229 |
} |
229 |
} |
| 230 |
|
230 |
|
| 231 |
sub new_object { |
231 |
sub new_object { |
| 232 |
- |
|
|