From 758e5403d5046feb13555527032c63896995bc8f Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 4 Nov 1999 22:02:41 +0000 Subject: [PATCH] Working on web interface --- C4/Output.pm | 10 ++++++++-- C4/Search.pm | 20 ++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index a0df7bd..71bf129 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -11,7 +11,7 @@ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 0.01; @ISA = qw(Exporter); -@EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow); +@EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow &mklink); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], # your exported package globals go here, @@ -85,6 +85,12 @@ sub endpage{ my $string="\n"; return($string); } - + +sub mklink { + my ($url,$text)=@_; + my $string="$text"; + return ($string); +} + END { } # module clean-up code here (global destructor) diff --git a/C4/Search.pm b/C4/Search.pm index efc5c4b..3061064 100755 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -80,14 +80,14 @@ sub CatSearch { last SWITCH; }; if ($type eq 'a') { - $query="Select * from biblio,catalogueentry + $query="Select count(*) from biblio,catalogueentry where (catalogueentry.catalogueentry = biblio.author) and (catalogueentry.catalogueentry like '%$searchstring%') and (entrytype like '$type%')"; last SWITCH; }; if ($type eq 't') { - $query="Select * from biblio,catalogueentry + $query="Select count(*) from biblio,catalogueentry where (catalogueentry.catalogueentry = biblio.title) and (catalogueentry.catalogueentry like '%$searchstring%') and (entrytype like '$type%')"; @@ -106,23 +106,31 @@ sub CatSearch { '%$searchstring%' and entrytype like '%$type%'"; last SWITCH; } - $query=$query." order by catalogueentry.catalogueentry limit $num,$offset"; -# print "$query\n"; + + print "$query\n"; my $sth=$dbh->prepare($query); $sth->execute; + my $count=$sth->fetchrow_hashref; + $sth->finish; + $query=~ s/count\(\*\)/\*/g; + $query=$query." order by catalogueentry.catalogueentry limit $num,$offset"; + $sth=$dbh->prepare($query); + $sth->execute; + my $i=0; my @results; while (my $data=$sth->fetchrow_hashref){ # print "$data->{'catalogueentry'} # $data->{'biblionumber'} \n"; # $results[$i]=ItemInfo($env,$data->{'biblionumber'}); - $results[$i]="$data->{'biblionumber'}\t$data->{'catalogueentry'}"; + $results[$i]="$data->{'biblionumber'}\t$data->{'title'}\t + $data->{'author'}"; $i++; } $sth->execute; $sth->finish; $dbh->disconnect; - return(@results); + return($count->{'count'},@results); } sub ItemInfo {