View | Details | Raw Unified | Return to bug 4162
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (-1 / +6 lines)
Lines 102-109 $(document).ready(function(){ Link Here
102
    <div id="yui-main">
102
    <div id="yui-main">
103
    <div class="yui-b">
103
    <div class="yui-b">
104
    <h1>Inventory/Stocktaking</h1>
104
    <h1>Inventory/Stocktaking</h1>
105
    [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>[% END %]
105
    [% IF (moddatecount) %]<div class="dialog message">[% moddatecount %] items modified : datelastseen set to [% date | $KohaDates %]</div>
106
    <div class="dialog alert">Number of potential barcodes read: [% LinesRead %]</div>[% END %]
106
    [% IF (errorfile) %]<div class="dialog alert">[% errorfile %] can't be opened</div>[% END %]
107
    [% IF (errorfile) %]<div class="dialog alert">[% errorfile %] can't be opened</div>[% END %]
108
    [% IF (err_length && err_length==1) %]<div class="dialog alert">There was 1 barcode that was too long.</div>[% END %]
109
    [% IF (err_length && err_length>1) %]<div class="dialog alert">There were [% err_length %] barcodes that were too long.</div>[% END %]
110
    [% IF (err_data && err_data==1) %]<div class="dialog alert">There was 1 barcode that contained at least one unprintable character.</div>[% END %]
111
    [% IF (err_data && err_data>1) %]<div class="dialog alert">There were [% err_data %] barcodes that contained at least one unprintable character.</div>[% END %]
107
    [% FOREACH error IN errorloop %]
112
    [% FOREACH error IN errorloop %]
108
        <div class="dialog alert">
113
        <div class="dialog alert">
109
            [% error.barcode %]
114
            [% error.barcode %]
(-)a/tools/inventory.pl (-1 / +32 lines)
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
- 

Return to bug 4162