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 <crc@liblime.com> Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
parent
8f377faa76
commit
a91b10dd57
2 changed files with 6 additions and 9 deletions
|
@ -76,7 +76,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="yui-u">
|
<div class="yui-u">
|
||||||
<form name="barcodefile" method="post" action="/cgi-bin/koha/tools/inventory.pl">
|
<form name="barcodefile" method="post" action="/cgi-bin/koha/tools/inventory.pl" enctype="multipart/form-data">
|
||||||
<fieldset class="rows">
|
<fieldset class="rows">
|
||||||
<legend>Use a barcode file</legend>
|
<legend>Use a barcode file</legend>
|
||||||
<ol>
|
<ol>
|
||||||
|
|
|
@ -100,9 +100,7 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
|
||||||
my $dbh=C4::Context->dbh;
|
my $dbh=C4::Context->dbh;
|
||||||
my $date = format_date_in_iso($input->param('setdate')) || C4::Dates->today('iso');
|
my $date = format_date_in_iso($input->param('setdate')) || C4::Dates->today('iso');
|
||||||
# warn "$date";
|
# warn "$date";
|
||||||
my $strsth="update items set (datelastseen = $date) where items.barcode =?";
|
my $strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null";
|
||||||
my $qupdate = $dbh->prepare($strsth);
|
|
||||||
$strsth="select * from issues, items where items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate is null";
|
|
||||||
my $qonloan = $dbh->prepare($strsth);
|
my $qonloan = $dbh->prepare($strsth);
|
||||||
$strsth="select * from items where items.barcode =? and issues.wthdrawn=1";
|
$strsth="select * from items where items.barcode =? and issues.wthdrawn=1";
|
||||||
my $qwthdrawn = $dbh->prepare($strsth);
|
my $qwthdrawn = $dbh->prepare($strsth);
|
||||||
|
@ -114,10 +112,10 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
|
||||||
if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){
|
if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){
|
||||||
push @errorloop, {'barcode'=>$barcode,'ERR_WTHDRAWN'=>1};
|
push @errorloop, {'barcode'=>$barcode,'ERR_WTHDRAWN'=>1};
|
||||||
}else{
|
}else{
|
||||||
$qupdate->execute($barcode);
|
my $item = GetItem('', $barcode);
|
||||||
$count += $qupdate->rows;
|
if (defined $item){
|
||||||
# warn "$count";
|
ModItem({ datelastseen => $date }, undef, $item->{'itemnumber'});
|
||||||
if ($count){
|
$count++;
|
||||||
$qonloan->execute($barcode);
|
$qonloan->execute($barcode);
|
||||||
if ($qonloan->rows){
|
if ($qonloan->rows){
|
||||||
my $data = $qonloan->fetchrow_hashref;
|
my $data = $qonloan->fetchrow_hashref;
|
||||||
|
@ -130,7 +128,6 @@ if ($uploadbarcodes && length($uploadbarcodes)>0){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$qupdate->finish;
|
|
||||||
$qonloan->finish;
|
$qonloan->finish;
|
||||||
$qwthdrawn->finish;
|
$qwthdrawn->finish;
|
||||||
$template->param(date=>format_date($date),Number=>$count);
|
$template->param(date=>format_date($date),Number=>$count);
|
||||||
|
|
Loading…
Reference in a new issue