From a91b10dd57327190856e4d302dca9b9b7c752a4b Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 3 Jan 2008 12:36:25 -0600 Subject: [PATCH] inventory: two fixes * Replaced direct "update items" with ModItem call * fixed problem in template that prevent barcode file upload from working Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- .../prog/en/modules/tools/inventory.tmpl | 2 +- tools/inventory.pl | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl index 59d9613f9a..e6342c78ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tmpl @@ -76,7 +76,7 @@
-
+
Use a barcode file
    diff --git a/tools/inventory.pl b/tools/inventory.pl index 48d9c50538..d10cbdeb29 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -100,9 +100,7 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){ my $dbh=C4::Context->dbh; my $date = format_date_in_iso($input->param('setdate')) || C4::Dates->today('iso'); # warn "$date"; - my $strsth="update items set (datelastseen = $date) where items.barcode =?"; - my $qupdate = $dbh->prepare($strsth); - $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null"; + my $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null"; my $qonloan = $dbh->prepare($strsth); $strsth="select * from items where items.barcode =? and issues.wthdrawn=1"; my $qwthdrawn = $dbh->prepare($strsth); @@ -114,10 +112,10 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){ if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){ push @errorloop, {'barcode'=>$barcode,'ERR_WTHDRAWN'=>1}; }else{ - $qupdate->execute($barcode); - $count += $qupdate->rows; -# warn "$count"; - if ($count){ + my $item = GetItem('', $barcode); + if (defined $item){ + ModItem({ datelastseen => $date }, undef, $item->{'itemnumber'}); + $count++; $qonloan->execute($barcode); if ($qonloan->rows){ my $data = $qonloan->fetchrow_hashref; @@ -130,7 +128,6 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){ } } } - $qupdate->finish; $qonloan->finish; $qwthdrawn->finish; $template->param(date=>format_date($date),Number=>$count); -- 2.20.1