Lines 244-259
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 {lc($_)=>1} $existing_items->get_column('barcode'); |
261 |
my %exists = map {lc($_)=>1} $existing_items->get_column('barcode'); |
Lines 264-269
if ($op eq "show"){
Link Here
|
264 |
@notfoundbarcodes = grep { !$exists{$_} } @contentlist; |
266 |
@notfoundbarcodes = grep { !$exists{$_} } @contentlist; |
265 |
} |
267 |
} |
266 |
elsif ( $filecontent eq 'itemid_file') { |
268 |
elsif ( $filecontent eq 'itemid_file') { |
|
|
269 |
@contentlist = uniq @contentlist; |
267 |
@itemnumbers = Koha::Items->search({ itemnumber => \@contentlist })->get_column('itemnumber'); |
270 |
@itemnumbers = Koha::Items->search({ itemnumber => \@contentlist })->get_column('itemnumber'); |
268 |
my %exists = map {$_=>1} @itemnumbers; |
271 |
my %exists = map {$_=>1} @itemnumbers; |
269 |
@notfounditemnumbers = grep { !$exists{$_} } @contentlist; |
272 |
@notfounditemnumbers = grep { !$exists{$_} } @contentlist; |
Lines 275-282
if ($op eq "show"){
Link Here
|
275 |
push @itemnumbers, $itm->{itemnumber}; |
278 |
push @itemnumbers, $itm->{itemnumber}; |
276 |
} |
279 |
} |
277 |
} |
280 |
} |
278 |
if ( my $list=$input->param('barcodelist')){ |
281 |
if ( my $list = $input->param('barcodelist') ) { |
279 |
push my @barcodelist, uniq( split(/\s\n/, $list) ); |
282 |
my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list ); |
|
|
283 |
@barcodelist = uniq @barcodelist; |
280 |
|
284 |
|
281 |
my $existing_items = Koha::Items->search({ barcode => \@barcodelist }); |
285 |
my $existing_items = Koha::Items->search({ barcode => \@barcodelist }); |
282 |
@itemnumbers = $existing_items->get_column('itemnumber'); |
286 |
@itemnumbers = $existing_items->get_column('itemnumber'); |