[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/html-template Search.pm,1.3,1.3.2.1
From: |
Andrew Arensburger |
Subject: |
[Koha-cvs] CVS: koha/html-template Search.pm,1.3,1.3.2.1 |
Date: |
Thu, 03 Oct 2002 19:35:47 -0700 |
Update of /cvsroot/koha/koha/html-template
In directory usw-pr-cvs1:/tmp/cvs-serv21667
Modified Files:
Tag: arensb-context
Search.pm
Log Message:
Use C4::Connect instead of C4::Database, C4::Connect->dbh instead
C4Connect.
Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/html-template/Search.pm,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -C2 -r1.3 -r1.3.2.1
*** Search.pm 14 Aug 2002 18:12:53 -0000 1.3
--- Search.pm 4 Oct 2002 02:35:45 -0000 1.3.2.1
***************
*** 25,29 ****
require Exporter;
use DBI;
! use C4::Database;
use C4::Reserves2;
use Set::Scalar;
--- 25,29 ----
require Exporter;
use DBI;
! use C4::Context;
use C4::Reserves2;
use Set::Scalar;
***************
*** 77,81 ****
sub findguarantees{
my ($bornum)address@hidden;
! my $dbh=C4Connect;
my $query="select cardnumber,borrowernumber from borrowers where
guarantor='$bornum'";
--- 77,81 ----
sub findguarantees{
my ($bornum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="select cardnumber,borrowernumber from borrowers where
guarantor='$bornum'";
***************
*** 89,98 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,address@hidden);
}
sub findguarantor{
my ($bornum)address@hidden;
! my $dbh=C4Connect;
my $query="select guarantor from borrowers where
borrowernumber='$bornum'";
--- 89,97 ----
}
$sth->finish;
return($i,address@hidden);
}
sub findguarantor{
my ($bornum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="select guarantor from borrowers where
borrowernumber='$bornum'";
***************
*** 107,111 ****
$data=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return($data);
}
--- 106,109 ----
***************
*** 113,117 ****
sub systemprefs {
my %systemprefs;
! my $dbh=C4Connect;
my $sth=$dbh->prepare("select variable,value from systempreferences");
$sth->execute;
--- 111,115 ----
sub systemprefs {
my %systemprefs;
! my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select variable,value from systempreferences");
$sth->execute;
***************
*** 120,129 ****
}
$sth->finish;
- $dbh->disconnect;
return(%systemprefs);
}
sub NewBorrowerNumber {
! my $dbh=C4Connect;
my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");
$sth->execute;
--- 118,126 ----
}
$sth->finish;
return(%systemprefs);
}
sub NewBorrowerNumber {
! my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("Select max(borrowernumber) from borrowers");
$sth->execute;
***************
*** 131,135 ****
$sth->finish;
$data->{'max(borrowernumber)'}++;
- $dbh->disconnect;
return($data->{'max(borrowernumber)'});
}
--- 128,131 ----
***************
*** 138,142 ****
sub KeywordSearch {
my ($env,$type,$search,$num,$offset)address@hidden;
! my $dbh = &C4Connect;
my $resulthash;
$search->{'keyword'}=~ s/ +$//;
--- 134,138 ----
sub KeywordSearch {
my ($env,$type,$search,$num,$offset)address@hidden;
! my $dbh = C4::Context->dbh;
my $resulthash;
$search->{'keyword'}=~ s/ +$//;
***************
*** 307,311 ****
}
}
- $dbh->disconnect;
#$count=$i;
--- 303,306 ----
***************
*** 315,319 ****
sub KeywordSearch2 {
my ($env,$type,$search,$num,$offset)address@hidden;
! my $dbh = &C4Connect;
$search->{'keyword'}=~ s/ +$//;
$search->{'keyword'}=~ s/'/\\'/;
--- 310,314 ----
sub KeywordSearch2 {
my ($env,$type,$search,$num,$offset)address@hidden;
! my $dbh = C4::Context->dbh;
$search->{'keyword'}=~ s/ +$//;
$search->{'keyword'}=~ s/'/\\'/;
***************
*** 455,459 ****
}
$sth->finish;
- $dbh->disconnect;
# $i--;
# $i++;
--- 450,453 ----
***************
*** 463,467 ****
sub CatSearch {
my ($env,$type,$search,$num,$offset)address@hidden;
! my $dbh = &C4Connect;
my $query = '';
my @results;
--- 457,461 ----
sub CatSearch {
my ($env,$type,$search,$num,$offset)address@hidden;
! my $dbh = C4::Context->dbh;
my $query = '';
my @results;
***************
*** 717,721 ****
sub subsearch {
my ($env,$subject)address@hidden;
! my $dbh=C4Connect();
$subject=$dbh->quote($subject);
my $query="Select * from biblio,bibliosubject where
--- 711,715 ----
sub subsearch {
my ($env,$subject)address@hidden;
! my $dbh = C4::Context->dbh;
$subject=$dbh->quote($subject);
my $query="Select * from biblio,bibliosubject where
***************
*** 732,736 ****
}
$sth->finish;
- $dbh->disconnect;
return(@results);
}
--- 726,729 ----
***************
*** 739,743 ****
sub ItemInfo {
my ($env,$biblionumber,$type)address@hidden;
! my $dbh = &C4Connect;
my $query="Select * from items,biblio,biblioitems,branches
where (items.biblioitemnumber = biblioitems.biblioitemnumber)
--- 732,736 ----
sub ItemInfo {
my ($env,$biblionumber,$type)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from items,biblio,biblioitems,branches
where (items.biblioitemnumber = biblioitems.biblioitemnumber)
***************
*** 815,819 ****
$sth2->finish;
- $dbh->disconnect;
return(@results);
}
--- 808,811 ----
***************
*** 822,826 ****
my ($env,$biblionumber)address@hidden;
#debug_msg($env,"GetItems");
! my $dbh = &C4Connect;
my $query = "Select * from biblioitems where (biblionumber =
$biblionumber)";
#debug_msg($env,$query);
--- 814,818 ----
my ($env,$biblionumber)address@hidden;
#debug_msg($env,"GetItems");
! my $dbh = C4::Context->dbh;
my $query = "Select * from biblioitems where (biblionumber =
$biblionumber)";
#debug_msg($env,$query);
***************
*** 855,859 ****
}
$sth->finish;
- $dbh->disconnect;
return(@results);
}
--- 847,850 ----
***************
*** 861,865 ****
sub itemdata {
my ($barcode)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from items,biblioitems where barcode='$barcode'
and items.biblioitemnumber=biblioitems.biblioitemnumber";
--- 852,856 ----
sub itemdata {
my ($barcode)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from items,biblioitems where barcode='$barcode'
and items.biblioitemnumber=biblioitems.biblioitemnumber";
***************
*** 868,872 ****
my $data=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return($data);
}
--- 859,862 ----
***************
*** 874,878 ****
sub bibdata {
my ($bibnum,$type)address@hidden;
! my $dbh=C4Connect;
my $query="Select *,biblio.notes
from biblio,biblioitems
--- 864,868 ----
sub bibdata {
my ($bibnum,$type)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select *,biblio.notes
from biblio,biblioitems
***************
*** 894,898 ****
}
$sth->finish;
- $dbh->disconnect;
return($data);
}
--- 884,887 ----
***************
*** 900,904 ****
sub bibitemdata {
my ($bibitem)address@hidden;
! my $dbh=C4Connect;
my $query="Select *,biblioitems.notes as bnotes from
biblio,biblioitems,itemtypes where biblio.biblionumber=
biblioitems.biblionumber and biblioitemnumber=$bibitem and
--- 889,893 ----
sub bibitemdata {
my ($bibitem)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select *,biblioitems.notes as bnotes from
biblio,biblioitems,itemtypes where biblio.biblionumber=
biblioitems.biblionumber and biblioitemnumber=$bibitem and
***************
*** 908,912 ****
my $data=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return($data);
}
--- 897,900 ----
***************
*** 914,918 ****
sub subject {
my ($bibnum)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from bibliosubject where biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
--- 902,906 ----
sub subject {
my ($bibnum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from bibliosubject where biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
***************
*** 925,929 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,address@hidden);
}
--- 913,916 ----
***************
*** 931,935 ****
sub addauthor {
my ($bibnum)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from additionalauthors where biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
--- 918,922 ----
sub addauthor {
my ($bibnum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from additionalauthors where biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
***************
*** 942,946 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,address@hidden);
}
--- 929,932 ----
***************
*** 948,952 ****
sub subtitle {
my ($bibnum)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from bibliosubtitle where biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
--- 934,938 ----
sub subtitle {
my ($bibnum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from bibliosubtitle where biblionumber=$bibnum";
my $sth=$dbh->prepare($query);
***************
*** 959,963 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,address@hidden);
}
--- 945,948 ----
***************
*** 967,971 ****
sub itemissues {
my ($bibitem,$biblio)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from items where
items.biblioitemnumber='$bibitem'";
--- 952,956 ----
sub itemissues {
my ($bibitem,$biblio)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from items where
items.biblioitemnumber='$bibitem'";
***************
*** 1007,1011 ****
}
$sth->finish;
- $dbh->disconnect;
return(@results);
}
--- 992,995 ----
***************
*** 1013,1017 ****
sub itemnodata {
my ($env,$dbh,$itemnumber) = @_;
! $dbh=C4Connect;
my $query="Select * from biblio,items,biblioitems
where items.itemnumber = '$itemnumber'
--- 997,1001 ----
sub itemnodata {
my ($env,$dbh,$itemnumber) = @_;
! $dbh = C4::Context->dbh;
my $query="Select * from biblio,items,biblioitems
where items.itemnumber = '$itemnumber'
***************
*** 1022,1026 ****
my $data=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return($data);
}
--- 1006,1009 ----
***************
*** 1030,1034 ****
sub BornameSearch {
my ($env,$searchstring,$type)address@hidden;
! my $dbh = &C4Connect;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
--- 1013,1017 ----
sub BornameSearch {
my ($env,$searchstring,$type)address@hidden;
! my $dbh = C4::Context->dbh;
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
***************
*** 1056,1060 ****
# $sth->execute;
$sth->finish;
- $dbh->disconnect;
return ($cnt,address@hidden);
}
--- 1039,1042 ----
***************
*** 1063,1067 ****
my ($cardnumber,$bornum)address@hidden;
$cardnumber = uc $cardnumber;
! my $dbh=C4Connect;
my $query;
if ($bornum eq ''){
--- 1045,1049 ----
my ($cardnumber,$bornum)address@hidden;
$cardnumber = uc $cardnumber;
! my $dbh = C4::Context->dbh;
my $query;
if ($bornum eq ''){
***************
*** 1074,1078 ****
my $data=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return($data);
}
--- 1056,1059 ----
***************
*** 1080,1084 ****
sub borrissues {
my ($bornum)address@hidden;
! my $dbh=C4Connect;
my $query;
$query="Select * from issues,biblio,items where borrowernumber='$bornum' and
--- 1061,1065 ----
sub borrissues {
my ($bornum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query;
$query="Select * from issues,biblio,items where borrowernumber='$bornum' and
***************
*** 1095,1099 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,address@hidden);
}
--- 1076,1079 ----
***************
*** 1101,1105 ****
sub allissues {
my ($bornum,$order,$limit)address@hidden;
! my $dbh=C4Connect;
my $query;
$query="Select * from issues,biblio,items,biblioitems
--- 1081,1085 ----
sub allissues {
my ($bornum,$order,$limit)address@hidden;
! my $dbh = C4::Context->dbh;
my $query;
$query="Select * from issues,biblio,items,biblioitems
***************
*** 1121,1125 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,address@hidden);
}
--- 1101,1104 ----
***************
*** 1127,1131 ****
sub borrdata2 {
my ($env,$bornum)address@hidden;
! my $dbh=C4Connect;
my $query="Select count(*) from issues where borrowernumber='$bornum' and
returndate is NULL";
--- 1106,1110 ----
sub borrdata2 {
my ($env,$bornum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select count(*) from issues where borrowernumber='$bornum' and
returndate is NULL";
***************
*** 1144,1148 ****
my $data3=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return($data2->{'count(*)'},$data->{'count(*)'},$data3->{'sum(amountoutstanding)'});
--- 1123,1126 ----
***************
*** 1152,1156 ****
sub getboracctrecord {
my ($env,$params) = @_;
! my $dbh=C4Connect;
my @acctlines;
my $numlines=0;
--- 1130,1134 ----
sub getboracctrecord {
my ($env,$params) = @_;
! my $dbh = C4::Context->dbh;
my @acctlines;
my $numlines=0;
***************
*** 1175,1179 ****
}
$sth->finish;
- $dbh->disconnect;
return ($numlines,address@hidden,$total);
}
--- 1153,1156 ----
***************
*** 1181,1185 ****
sub itemcount {
my ($env,$bibnum,$type)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from items where
biblionumber=$bibnum ";
--- 1158,1162 ----
sub itemcount {
my ($env,$bibnum,$type)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from items where
biblionumber=$bibnum ";
***************
*** 1241,1245 ****
$sth2->finish;
$sth->finish;
- $dbh->disconnect;
return
($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit,$ocount);
}
--- 1218,1221 ----
***************
*** 1247,1251 ****
sub ItemType {
my ($type)address@hidden;
! my $dbh=C4Connect;
my $query="select description from itemtypes where itemtype='$type'";
my $sth=$dbh->prepare($query);
--- 1223,1227 ----
sub ItemType {
my ($type)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="select description from itemtypes where itemtype='$type'";
my $sth=$dbh->prepare($query);
***************
*** 1253,1257 ****
my $dat=$sth->fetchrow_hashref;
$sth->finish;
- $dbh->disconnect;
return ($dat->{'description'});
}
--- 1229,1232 ----
***************
*** 1259,1263 ****
sub bibitems {
my ($bibnum)address@hidden;
! my $dbh=C4Connect;
my $query="Select * from biblioitems,itemtypes,items where
biblioitems.biblionumber='$bibnum' and
biblioitems.itemtype=itemtypes.itemtype and
--- 1234,1238 ----
sub bibitems {
my ($bibnum)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select * from biblioitems,itemtypes,items where
biblioitems.biblionumber='$bibnum' and
biblioitems.itemtype=itemtypes.itemtype and
***************
*** 1273,1277 ****
}
$sth->finish;
- $dbh->disconnect;
return($i,@results);
}
--- 1248,1251 ----
***************
*** 1279,1283 ****
sub barcodes{
my ($biblioitemnumber)address@hidden;
! my $dbh=C4Connect;
my $query="Select barcode from items where
biblioitemnumber='$biblioitemnumber'";
--- 1253,1257 ----
sub barcodes{
my ($biblioitemnumber)address@hidden;
! my $dbh = C4::Context->dbh;
my $query="Select barcode from items where
biblioitemnumber='$biblioitemnumber'";
***************
*** 1291,1295 ****
}
$sth->finish;
- $dbh->disconnect;
return(@barcodes);
--- 1265,1268 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/html-template Search.pm,1.3,1.3.2.1,
Andrew Arensburger <=