[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4 Search.pm,1.27,1.28
From: |
Chris Cormack |
Subject: |
[Koha-cvs] CVS: koha/C4 Search.pm,1.27,1.28 |
Date: |
Mon, 20 May 2002 18:17:46 -0700 |
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv10483/C4
Modified Files:
Search.pm
Log Message:
Some minor changes to get detail.pl and moredetail.pl working nicely with
html::template
Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** Search.pm 14 May 2002 21:36:39 -0000 1.27
--- Search.pm 21 May 2002 01:17:44 -0000 1.28
***************
*** 22,26 ****
&getboracctrecord &ItemType &itemissues &subject &subtitle
&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
! &findguarantor &getwebsites &getwebbiblioitems &catalogsearch);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
--- 22,26 ----
&getboracctrecord &ItemType &itemissues &subject &subtitle
&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
! &findguarantor &getwebsites &getwebbiblioitems &catalogsearch itemcount2);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
***************
*** 124,129 ****
--- 124,132 ----
# }
my ($count,@results);
+ print STDERR "Doing a search \n";
if ($search->{'itemnumber'} ne '' || $search->{'isbn'} ne ''){
+ print STDERR "Doing a precise search\n";
($count,@results)=CatSearch($env,'precise',$search,$num,$offset);
+
} else {
if ($search->{'subject'} ne ''){
***************
*** 132,139 ****
if ($search->{'keyword'} ne ''){
($count,@results)=&KeywordSearch($env,'keyword',$search,$num,$offset);
! } elsif ($search->{'title'} ne '' || $search->{'author'} ne '' ||
! $search->{'illustrator'} ne '' || $search->{'dewey'} ne '' ||
! $search->{'class'} ne ''){
($count,@results)=CatSearch($env,'loose',$search,$num,$offset);
}
}
--- 135,141 ----
if ($search->{'keyword'} ne ''){
($count,@results)=&KeywordSearch($env,'keyword',$search,$num,$offset);
! } else {
($count,@results)=CatSearch($env,'loose',$search,$num,$offset);
+
}
}
***************
*** 141,146 ****
if ($env->{itemcount}) {
foreach my $data (@results){
! my ($count, $lcount, $nacount, $fcount, $scount, $lostcount, $mending,
$transit, $ocount) = itemcount($env, $data->{'biblionumber'}, 'intra');
! $data->{'itemcount'}=$count;
}
}
--- 143,156 ----
if ($env->{itemcount}) {
foreach my $data (@results){
! my ($counts) = itemcount2($env, $data->{'biblionumber'}, 'intra');
! my $subject2=$data->{'subject'};
! $subject2=~ s/ /%20/g;
! $data->{'itemcount'}=$counts->{'total'};
! foreach my $key (keys %$counts){
! if ($key ne 'total'){
! $data->{'location'}.="$key $counts->{$key} ";
! }
! }
! $data->{'subject2'}=$subject2;
}
}
***************
*** 390,394 ****
#or seriestitle like '%$search->{'title'}%')";
}
!
$query.=" group by biblio.biblionumber";
} else {
--- 400,408 ----
#or seriestitle like '%$search->{'title'}%')";
}
! if ($search->{'abstract'} ne ''){
! $query.= " and (abstract like '%$search->{'abstract'}%')";
! }
!
!
$query.=" group by biblio.biblionumber";
} else {
***************
*** 433,436 ****
--- 447,453 ----
$query=$query."))";
}
+ if ($search->{'abstract'} ne ''){
+ $query.= " and (abstract like '%$search->{'abstract'}%')";
+ }
} elsif ($search->{'class'} ne ''){
$query="select * from biblioitems,biblio where
biblio.biblionumber=biblioitems.biblionumber";
***************
*** 453,462 ****
and biblioitems.dewey like '$search->{'dewey'}%'";
} elsif ($search->{'illustrator'} ne '') {
! if ($search->{'illustrator'} ne ''){
! $query="select * from biblioitems,biblio
where biblio.biblionumber=biblioitems.biblionumber
and biblioitems.illus like '%".$search->{'illustrator'}."%'";
}
! }
$query .=" group by biblio.biblionumber";
}
--- 470,484 ----
and biblioitems.dewey like '$search->{'dewey'}%'";
} elsif ($search->{'illustrator'} ne '') {
! $query="select * from biblioitems,biblio
where biblio.biblionumber=biblioitems.biblionumber
and biblioitems.illus like '%".$search->{'illustrator'}."%'";
+ } elsif ($search->{'publisher'} ne ''){
+ $query.= "Select * from biblio,biblioitems where biblio.biblionumber
+ =biblioitems.biblionumber and (publishercode like
'%$search->{'publisher'}%')";
+ } elsif ($search->{'abstract'} ne ''){
+ $query.= "Select * from biblio where abstract like
'%$search->{'abstract'}%'";
}
!
!
$query .=" group by biblio.biblionumber";
}
***************
*** 484,489 ****
}
if ($type eq 'precise'){
! $query="select * from items,biblio ";
if ($search->{'item'} ne ''){
my $search2=uc $search->{'item'};
$query=$query." where
--- 506,512 ----
}
if ($type eq 'precise'){
!
if ($search->{'item'} ne ''){
+ $query="select * from items,biblio ";
my $search2=uc $search->{'item'};
$query=$query." where
***************
*** 495,499 ****
my $query1 = "select * from biblioitems where isbn='$search2'";
my $sth1=$dbh->prepare($query1);
! # print $query1;
$sth1->execute;
my $i2=0;
--- 518,522 ----
my $query1 = "select * from biblioitems where isbn='$search2'";
my $sth1=$dbh->prepare($query1);
! print STDERR "$query1\n";
$sth1->execute;
my $i2=0;
***************
*** 530,534 ****
}
}
! #print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
--- 553,557 ----
}
}
! print STDERR "$query\n";
my $sth=$dbh->prepare($query);
$sth->execute;
***************
*** 553,557 ****
$query.=" and illus like '%".$search->{'illustrator'}."%' ";
}
! #print $query;
my $sti=$dbh->prepare($query);
$sti->execute;
--- 576,583 ----
$query.=" and illus like '%".$search->{'illustrator'}."%' ";
}
! if ($search->{'publisher'} ne ''){
! $query.= " and (publishercode like '%$search->{'publisher'}%')";
! }
! print STDERR "$query\n";
my $sti=$dbh->prepare($query);
$sti->execute;
***************
*** 649,652 ****
--- 675,679 ----
}
if ($datedue eq ''){
+ $datedue="Available";
my
($rescount,$reserves)=Findgroupreserve($data->{'biblioitemnumber'},$biblionumber);
***************
*** 673,678 ****
my @temp=split('-',$data->{'datelastseen'});
my $date="$temp[2]/$temp[1]/$temp[0]";
!
$results[$i]="$data->{'title'}\t$data->{'barcode'}\t$datedue\t$data->{'branchname'}\t$class\t$data->{'itemnumber'}\t$data->{'itemtype'}\t$date\t$data->{'biblioitemnumber'}\t$data->{'volumeddesc'}";
! # print "$results[$i] <br>";
$i++;
}
--- 700,707 ----
my @temp=split('-',$data->{'datelastseen'});
my $date="$temp[2]/$temp[1]/$temp[0]";
! $data->{'datelastseen'}=$date;
! $data->{'datedue'}=$datedue;
! $data->{'class'}=$class;
! $results[$i]=$data;
$i++;
}
***************
*** 686,690 ****
$ocount=$data->{'quantity'} - $data->{'quantityreceived'};
if ($ocount > 0){
! $results[$i]="$data->{'title'}\t$data->{'barcode'}\t$ocount\tOn
Order\t\t$data->{'itemnumber'}\t$data->{'itemtype'}\t\t$data->{'biblioitemnumber'}\t$data->{'volumeddesc'}";
}
}
--- 715,721 ----
$ocount=$data->{'quantity'} - $data->{'quantityreceived'};
if ($ocount > 0){
! $data->{'ocount'}=$ocount;
! $data->{'order'}="One Order";
! $results[$i]=$data;
}
}
***************
*** 1088,1091 ****
--- 1119,1123 ----
}
+
sub itemcount {
my ($env,$bibnum,$type)address@hidden;
***************
*** 1160,1163 ****
--- 1192,1241 ----
}
+
+ sub itemcount2 {
+ my ($env,$bibnum,$type)address@hidden;
+ my $dbh=C4Connect;
+ my $query="Select * from items,branches where
+ biblionumber=$bibnum and items.holdingbranch=branches.branchcode";
+ if ($type ne 'intra'){
+ $query.=" and ((itemlost <>1 and itemlost <> 2) or itemlost is NULL) and
+ (wthdrawn <> 1 or wthdrawn is NULL)";
+ }
+ my $sth=$dbh->prepare($query);
+ # print $query;
+ $sth->execute;
+ my %counts;
+ $counts{'total'}=0;
+ while (my $data=$sth->fetchrow_hashref){
+ $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);
+ $sth2->execute;
+ if (my $data2=$sth2->fetchrow_hashref){
+ $counts{'notavailable'}++;
+ } else {
+ $counts{$data->{'branchname'}}++;
+ }
+ $sth2->finish;
+ }
+ my $query2="Select * from aqorders where biblionumber=$bibnum and
+ datecancellationprinted is NULL and quantity > quantityreceived";
+ my $sth2=$dbh->prepare($query2);
+ $sth2->execute;
+ if (my $data=$sth2->fetchrow_hashref){
+ $counts{'order'}=$data->{'quantity'} - $data->{'quantityreceived'};
+ }
+ $sth2->finish;
+ $sth->finish;
+ $dbh->disconnect;
+ return (\%counts);
+ }
+
+
sub ItemType {
my ($type)address@hidden;
***************
*** 1232,1235 ****
--- 1310,1314 ----
$sth->execute;
while (my $data = $sth->fetchrow_hashref) {
+ $data->{'url'} =~ s/^http:\/\///;
$results[$count] = $data;
$count++;
***************
*** 1253,1256 ****
--- 1332,1336 ----
$sth->execute;
while (my $data = $sth->fetchrow_hashref) {
+ $data->{'url'} =~ s/^http:\/\///;
$results[$count] = $data;
$count++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4 Search.pm,1.27,1.28,
Chris Cormack <=