[Koha-patches] [PATCH] Bug 3224 : inventory tool fails on DOS newlines
Ryan Higgins
rch at liblime.com
Thu May 14 09:46:45 CEST 2009
---
tools/inventory.pl | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/inventory.pl b/tools/inventory.pl
index 4fa9c94..f3de234 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);
--
1.5.6.2
More information about the Koha-patches
mailing list