$deleted_items++;
} else {
$not_deleted_items++;
- push @not_deleted, $itemdata->{'itemnumber'};
+ push @not_deleted, { itemnumber => $itemdata->{'itemnumber'}, barcode => $itemdata->{'barcode'}, title => $itemdata->{'title'}, $return => 1 };
}
} else {
my $localmarcitem=Item2Marc($itemdata);
if ($op eq "show"){
my $filefh = $input->upload('uploadfile');
my $filecontent = $input->param('filecontent');
+ my @notfoundbarcodes;
my @contentlist;
if ($filefh){
switch ($filecontent) {
case "barcode_file" {
- push @itemnumbers,map{GetItemnumberFromBarcode($_)} @contentlist;
- # Remove not found barcodes
- @itemnumbers = grep(!/^$/, @itemnumbers);
+ foreach my $barcode (@contentlist) {
+
+ my $itemnumber = GetItemnumberFromBarcode($barcode);
+ if ($itemnumber) {
+ push @itemnumbers,$itemnumber;
+ } else {
+ push @notfoundbarcodes, $barcode;
+ }
+ }
+
}
case "itemid_file" {
} else {
if ( my $list=$input->param('barcodelist')){
push my @barcodelist, split(/\s\n/, $list);
- push @itemnumbers,map{GetItemnumberFromBarcode($_)} @barcodelist;
- # Remove not found barcodes
- @itemnumbers = grep(!/^$/, @itemnumbers);
+
+ foreach my $barcode (@barcodelist) {
+
+ my $itemnumber = GetItemnumberFromBarcode($barcode);
+ if ($itemnumber) {
+ push @itemnumbers,$itemnumber;
+ } else {
+ push @notfoundbarcodes, $barcode;
+ }
+ }
}
}
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
$template->param(item => \@loop_data);
+ if (@notfoundbarcodes) {
+ my @notfoundbarcodesloop = map{{barcode=>$_}}@notfoundbarcodes;
+ $template->param(notfoundbarcodes => \@notfoundbarcodesloop);
+ }
$nextop="action"
} # -- End action="show"
if ($op eq "action") {
- my @not_deleted_loop = map{{itemnumber=>$_}}@not_deleted;
+ #my @not_deleted_loop = map{{itemnumber=>$_}}@not_deleted;
$template->param(
not_deleted_items => $not_deleted_items,
deleted_items => $deleted_items,
- not_deleted_itemnumbers => \@not_deleted_loop
+ not_deleted_loop => \@not_deleted
);
}