From 6ba0322fbaff83258a80442a273fd85a646dfa6b Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 6 Jun 2000 22:50:07 +0000 Subject: [PATCH] got on order showing up --- C4/Search.pm | 26 ++++++++++++++++++++------ search.pl | 9 ++++++++- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index b594b8b..8a17835 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -374,12 +374,18 @@ sub CatSearch { } } #print $query; + + my $sth=$dbh->prepare($query); + # if ($search->{'isbn'} eq ''){ $sth->execute; # } else { my $count=0; - + if ($search->{'title'} || $search->{'author'}){ + $query=$query." group by biblio.biblionumber"; +# $query=~ s/count\(\*\)/count\(biblio.biblionumber\)/; + } if ($type eq 'subject'){ while (my $data=$sth->fetchrow_arrayref){ $count++; @@ -389,10 +395,8 @@ sub CatSearch { $count=$data->[0]; } $sth->finish; +# print $query; $query=~ s/count\(\*\)/\*/g; - if ($search->{'title'} || $search->{'author'}){ - $query=$query." group by biblio.biblionumber"; - } if ($type ne 'precise' && $type ne 'subject'){ if ($search->{'author'} ne ''){ $query=$query." order by author,title limit $offset,$num"; @@ -920,6 +924,7 @@ sub itemcount { my $lostcount=0; my $mending=0; my $transit=0; + my $ocount=0; while (my $data=$sth->fetchrow_hashref){ $count++; my $query2="select * from issues,items where issues.itemnumber= @@ -951,10 +956,19 @@ sub itemcount { } } $sth2->finish; - } + } +# if ($count == 0){ + my $query2="Select * from aqorders where biblionumber=$bibnum"; + my $sth2=$dbh->prepare($query2); + $sth2->execute; + if (my $data=$sth2->fetchrow_hashref){ + $ocount=$data->{'quantity'}; + } + $count+=$ocount; + $sth2->finish; $sth->finish; $dbh->disconnect; - return ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit); + return ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount); } sub ItemType { diff --git a/search.pl b/search.pl index 0162202..e475e4e 100755 --- a/search.pl +++ b/search.pl @@ -138,7 +138,7 @@ while ($i < $count2){ $word=~ s/\n//g; my $url="/cgi-bin/koha/search.pl?author=$word&type=$type"; $stuff[0]=mklink($url,$stuff[0]); - my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=itemcount($env,$stuff[2],$type); + my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount)=itemcount($env,$stuff[2],$type); $stuff[4]=$count; if ($nacount > 0){ $stuff[5]=$stuff[5]."On Loan"; @@ -189,6 +189,13 @@ while ($i < $count2){ } $stuff[5].=" "; } + if ($ocount > 0){ + $stuff[5]=$stuff[5]."On Order"; + if ($ocount >1 ){ + $stuff[5]=$stuff[5]." ($ocount)"; + } + $stuff[5].=" "; + } if ($type ne 'opac'){ $stuff[6]=mklink("/cgi-bin/koha/request.pl?bib=$stuff[2]","Request");