|
Lines 160-168
if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) {
Link Here
|
| 160 |
|
160 |
|
| 161 |
my $count = 0; |
161 |
my $count = 0; |
| 162 |
|
162 |
|
|
|
163 |
my @barcodes; |
| 164 |
|
| 165 |
my $sth = $dbh->column_info(undef,undef,"items","barcode"); |
| 166 |
my $barcode_def = $sth->fetchall_hashref('COLUMN_NAME'); |
| 167 |
my $barcode_size = $barcode_def->{barcode}->{COLUMN_SIZE}; |
| 168 |
my $err_length=0; |
| 169 |
my $err_data=0; |
| 170 |
my $lines_read=0; |
| 171 |
binmode($uploadbarcodes, ":encoding(UTF-8)"); |
| 163 |
while (my $barcode=<$uploadbarcodes>){ |
172 |
while (my $barcode=<$uploadbarcodes>){ |
|
|
173 |
++$lines_read; |
| 164 |
$barcode =~ s/\r?\n$//; |
174 |
$barcode =~ s/\r?\n$//; |
| 165 |
next unless $barcode; |
175 |
next unless $barcode; |
|
|
176 |
if (length($barcode)>$barcode_size) { |
| 177 |
$err_length += 1; |
| 178 |
} |
| 179 |
my $check_barcode = $barcode; |
| 180 |
$check_barcode =~ s/\p{Print}//g; |
| 181 |
if (length($check_barcode)>0) { # Only printable unicode characters allowed. |
| 182 |
$err_data += 1; |
| 183 |
} |
| 184 |
next if length($barcode)>$barcode_size; |
| 185 |
next if ( length($check_barcode)>0 ); |
| 186 |
push @barcodes,$barcode; |
| 187 |
} |
| 188 |
$template->param( LinesRead => $lines_read ); |
| 189 |
if (! @barcodes) { |
| 190 |
push @errorloop, {'barcode'=>'No valid barcodes!'}; |
| 191 |
$op=''; # force the initial inventory screen again. |
| 192 |
} |
| 193 |
else { |
| 194 |
$template->param( err_length => $err_length, |
| 195 |
err_data => $err_data ); |
| 196 |
} |
| 197 |
foreach my $barcode (@barcodes) { |
| 166 |
if ( $qwithdrawn->execute($barcode) && $qwithdrawn->rows ) { |
198 |
if ( $qwithdrawn->execute($barcode) && $qwithdrawn->rows ) { |
| 167 |
push @errorloop, { 'barcode' => $barcode, 'ERR_WTHDRAWN' => 1 }; |
199 |
push @errorloop, { 'barcode' => $barcode, 'ERR_WTHDRAWN' => 1 }; |
| 168 |
} else { |
200 |
} else { |
| 169 |
- |
|
|