Distinguish between On Loan, Item Lost, and Withdrawn, instead of saying

just "not available".  Cf. Bug 112
This commit is contained in:
acli 2003-02-02 08:47:01 +00:00
parent bb771c2dd8
commit 16d67236c2

View file

@ -1,5 +1,4 @@
package C4::Search; package C4::Search;
#require '/u/acli/lib/cvs.pl'; # XXX
# Copyright 2000-2002 Katipo Communications # Copyright 2000-2002 Katipo Communications
# #
@ -2151,25 +2150,39 @@ sub itemcount2 {
$counts{'total'}=0; $counts{'total'}=0;
while (my $data=$sth->fetchrow_hashref){ while (my $data=$sth->fetchrow_hashref){
$counts{'total'}++; $counts{'total'}++;
my $query2="select * from issues,items where issues.itemnumber=
'$data->{'itemnumber'}' and returndate is NULL
and items.itemnumber=issues.itemnumber and ((items.itemlost <>1 and
items.itemlost <> 2) or items.itemlost is NULL)
and (wthdrawn <> 1 or wthdrawn is NULL)";
my $sth2=$dbh->prepare($query2); my $status;
$sth2->execute; for my $test (
# FIXME - fetchrow_hashref() can fail for any number of reasons [
# (e.g., a database server crash). Perhaps use a left join of some 'Item Lost',
# sort for this? 'select * from items
if (my $data2=$sth2->fetchrow_hashref){ where itemnumber=?
$counts{'not available'}++; and not ((items.itemlost <>1 and items.itemlost <> 2)
#my $x = "Not available, data2=" . (defined $data2? CGI::escapeHTML(cvs($data2)): "undef"); or items.itemlost is NULL)'
#$counts{$x}++; #XXX ], [
} else { 'Withdrawn',
$counts{$data->{'branchname'}}++; 'select * from items
where itemnumber=? and not (wthdrawn <> 1 or wthdrawn is NULL)'
], [
'On Loan', "select * from issues,items
where issues.itemnumber=? and returndate is NULL
and items.itemnumber=issues.itemnumber"
],
) {
my($testlabel, $query2) = @$test;
my $sth2=$dbh->prepare($query2);
$sth2->execute($data->{'itemnumber'});
# FIXME - fetchrow_hashref() can fail for any number of reasons
# (e.g., a database server crash). Perhaps use a left join of some
# sort for this?
$status = $testlabel if $sth2->fetchrow_hashref;
$sth2->finish;
last if defined $status;
} }
$sth2->finish; $status = $data->{'branchname'} unless defined $status;
$counts{$status}++;
} }
my $query2="Select * from aqorders where biblionumber=$bibnum and my $query2="Select * from aqorders where biblionumber=$bibnum and
datecancellationprinted is NULL and quantity > quantityreceived"; datecancellationprinted is NULL and quantity > quantityreceived";