<div id="yui-main">
<div class="yui-b">
<h1>Inventory/Stocktaking</h1>
- [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>[% END %]
+ [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>
+ <div class="dialog alert">Number of potential barcodes read: [% LinesRead %]</div>[% END %]
[% IF (errorfile) %]<div class="dialog alert">[% errorfile %] can't be opened</div>[% END %]
+ [% IF (err_length && err_length==1) %]<div class="dialog alert">There was 1 barcode that was too long.</div>[% END %]
+ [% IF (err_length && err_length>1) %]<div class="dialog alert">There were [% err_length %] barcodes that were too long.</div>[% END %]
+ [% IF (err_data && err_data==1) %]<div class="dialog alert">There was 1 barcode that contained at least one unprintable character.</div>[% END %]
+ [% IF (err_data && err_data>1) %]<div class="dialog alert">There were [% err_data %] barcodes that contained at least one unprintable character.</div>[% END %]
[% FOREACH error IN errorloop %]
<div class="dialog alert">
[% error.barcode %]
my $count = 0;
+ my @barcodes;
+
+ my $sth = $dbh->column_info(undef,undef,"items","barcode");
+ my $barcode_def = $sth->fetchall_hashref('COLUMN_NAME');
+ my $barcode_size = $barcode_def->{barcode}->{COLUMN_SIZE};
+ my $err_length=0;
+ my $err_data=0;
+ my $lines_read=0;
+ binmode($uploadbarcodes, ":encoding(UTF-8)");
while (my $barcode=<$uploadbarcodes>){
+ ++$lines_read;
$barcode =~ s/\r?\n$//;
next unless $barcode;
+ if (length($barcode)>$barcode_size) {
+ $err_length += 1;
+ }
+ my $check_barcode = $barcode;
+ $check_barcode =~ s/\p{Print}//g;
+ if (length($check_barcode)>0) { # Only printable unicode characters allowed.
+ $err_data += 1;
+ }
+ next if length($barcode)>$barcode_size;
+ next if ( length($check_barcode)>0 );
+ push @barcodes,$barcode;
+ }
+ $template->param( LinesRead => $lines_read );
+ if (! @barcodes) {
+ push @errorloop, {'barcode'=>'No valid barcodes!'};
+ $op=''; # force the initial inventory screen again.
+ }
+ else {
+ $template->param( err_length => $err_length,
+ err_data => $err_data );
+ }
+ foreach my $barcode (@barcodes) {
if ( $qwithdrawn->execute($barcode) && $qwithdrawn->rows ) {
push @errorloop, { 'barcode' => $barcode, 'ERR_WTHDRAWN' => 1 };
} else {