From 23f9411f39c1dcf47521db5ed7e922908e0821c8 Mon Sep 17 00:00:00 2001 From: Ryan Higgins Date: Thu, 14 May 2009 00:46:45 -0700 Subject: [PATCH] Bug 3224 : inventory tool fails on DOS newlines Signed-off-by: Galen Charlton --- tools/inventory.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index 4fa9c94835..f3de234c54 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -118,18 +118,17 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){ # warn "$date"; my $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =?"; my $qonloan = $dbh->prepare($strsth); - $strsth="select * from items where items.barcode =? and issues.wthdrawn=1"; + $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>){ - chomp $barcode; -# warn "$barcode"; + $barcode =~ s/\r?\n$//; if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){ push @errorloop, {'barcode'=>$barcode,'ERR_WTHDRAWN'=>1}; }else{ my $item = GetItem('', $barcode); - if (defined $item){ + if (defined $item && $item->{'itemnumber'}){ ModItem({ datelastseen => $date }, undef, $item->{'itemnumber'}); $count++; $qonloan->execute($barcode); -- 2.39.5