@@ -, +, @@ - Adds not found barcodes list into csv report --- tools/inventory.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/tools/inventory.pl +++ a/tools/inventory.pl @@ -139,6 +139,7 @@ $template->param(branchloop => \@branch_loop, datelastseen => $datelastseen, ); my @brcditems; +my @errorloop; if ($uploadbarcodes && length($uploadbarcodes)>0){ my $dbh=C4::Context->dbh; my $date = format_date_in_iso($input->param('setdate')) || C4::Dates->today('iso'); @@ -147,7 +148,6 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){ my $qonloan = $dbh->prepare($strsth); $strsth="select * from items where items.barcode =? and items.wthdrawn = 1"; my $qwthdrawn = $dbh->prepare($strsth); - my @errorloop; my $count=0; while (my $barcode=<$uploadbarcodes>){ $barcode =~ s/\r?\n$//; @@ -225,9 +225,10 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ ); $csv->combine(qw / title author barcode itemnumber homebranch location itemcallnumber notforloan lost damaged /); print $csv->string, "\n"; + my @keys = qw / title author barcode itemnumber homebranch location itemcallnumber notforloan lost damaged /; for my $re (@$res){ my @line; - for my $key ( qw / title author barcode itemnumber homebranch location itemcallnumber notforloan itemlost damaged / ) { + for my $key (@keys) { given ( $key ) { when ( /notforloan/ ) { push @line, GetAuthorisedValueDesc('', '', $re->{$key}, '', '', 'NOT_LOAN', ''); @@ -248,6 +249,17 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ $csv->combine(@line); print $csv->string, "\n"; } + # Adding not found barcodes + foreach my $error (@errorloop) { + my @line; + if ($error->{'ERR_BARCODE'}) { + push @line, map { $_ eq 'barcode' ? $error->{'barcode'} : ''} @keys; + push @line, "barcode not found"; + $csv->combine(@line); + print $csv->string, "\n"; + } + } + exit; } --