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

(-)a/tools/batchMod.pl (-4 / +8 lines)
Lines 244-265 if ($op eq "show"){ Link Here
244
    my $filecontent = $input->param('filecontent');
244
    my $filecontent = $input->param('filecontent');
245
    my ( @notfoundbarcodes, @notfounditemnumbers);
245
    my ( @notfoundbarcodes, @notfounditemnumbers);
246
246
247
    my @contentlist;
247
    my $split_chars = C4::Context->preference('BarcodeSeparators');
248
    if ($filefh){
248
    if ($filefh){
249
        binmode $filefh, ':encoding(UTF-8)';
249
        binmode $filefh, ':encoding(UTF-8)';
250
        my @contentlist;
250
        while (my $content=<$filefh>){
251
        while (my $content=<$filefh>){
251
            $content =~ s/[\r\n]*$//;
252
            $content =~ s/[\r\n]*$//;
252
            push @contentlist, $content if $content;
253
            push @contentlist, $content if $content;
253
        }
254
        }
254
255
255
        @contentlist = uniq @contentlist;
256
        if ($filecontent eq 'barcode_file') {
256
        if ($filecontent eq 'barcode_file') {
257
            @contentlist = grep /\S/, ( map { split /[$split_chars]/ } @contentlist );
258
            @contentlist = uniq @contentlist;
257
            my $existing_items = Koha::Items->search({ barcode => \@contentlist });
259
            my $existing_items = Koha::Items->search({ barcode => \@contentlist });
258
            @itemnumbers = $existing_items->get_column('itemnumber');
260
            @itemnumbers = $existing_items->get_column('itemnumber');
259
            my %exists = map {$_=>1} $existing_items->get_column('barcode');
261
            my %exists = map {$_=>1} $existing_items->get_column('barcode');
260
            @notfoundbarcodes = grep { !$exists{$_} } @contentlist;
262
            @notfoundbarcodes = grep { !$exists{$_} } @contentlist;
261
        }
263
        }
262
        elsif ( $filecontent eq 'itemid_file') {
264
        elsif ( $filecontent eq 'itemid_file') {
265
            @contentlist = uniq @contentlist;
263
            @itemnumbers = Koha::Items->search({ itemnumber => \@contentlist })->get_column('itemnumber');
266
            @itemnumbers = Koha::Items->search({ itemnumber => \@contentlist })->get_column('itemnumber');
264
            my %exists = map {$_=>1} @itemnumbers;
267
            my %exists = map {$_=>1} @itemnumbers;
265
            @notfounditemnumbers = grep { !$exists{$_} } @contentlist;
268
            @notfounditemnumbers = grep { !$exists{$_} } @contentlist;
Lines 271-278 if ($op eq "show"){ Link Here
271
                push @itemnumbers, $itm->{itemnumber};
274
                push @itemnumbers, $itm->{itemnumber};
272
            }
275
            }
273
        }
276
        }
274
        if ( my $list=$input->param('barcodelist')){
277
        if ( my $list = $input->param('barcodelist') ) {
275
            push my @barcodelist, uniq( split(/\s\n/, $list) );
278
            my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list );
279
            @barcodelist = uniq @barcodelist;
276
280
277
            my $existing_items = Koha::Items->search({ barcode => \@barcodelist });
281
            my $existing_items = Koha::Items->search({ barcode => \@barcodelist });
278
            @itemnumbers = $existing_items->get_column('itemnumber');
282
            @itemnumbers = $existing_items->get_column('itemnumber');
(-)a/tools/inventory.pl (-2 / +2 lines)
Lines 166-172 if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { Link Here
166
    my $lines_read=0;
166
    my $lines_read=0;
167
    binmode($uploadbarcodes, ":encoding(UTF-8)");
167
    binmode($uploadbarcodes, ":encoding(UTF-8)");
168
    while (my $barcode=<$uploadbarcodes>) {
168
    while (my $barcode=<$uploadbarcodes>) {
169
        push @uploadedbarcodes, grep { /\S/ } split( /[\n\r,;|-]/, $barcode );
169
        my $split_chars = C4::Context->preference('BarcodeSeparators');
170
        push @uploadedbarcodes, grep { /\S/ } split( /[$split_chars]/, $barcode );
170
    }
171
    }
171
    for my $barcode (@uploadedbarcodes) {
172
    for my $barcode (@uploadedbarcodes) {
172
        next unless $barcode;
173
        next unless $barcode;
173
- 

Return to bug 22996