[Koha-cvs] CVS: koha/C4 Accounts2.pm,1.13,1.14
Andrew Arensburger
arensb at users.sourceforge.net
Sat Oct 5 11:48:05 CEST 2002
Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv20403/C4
Modified Files:
Accounts2.pm
Log Message:
Merged with arensb-context branch: use C4::Context->dbh instead of
&C4Connect, and generally prefer C4::Context over C4::Database.
Index: Accounts2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Accounts2.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** Accounts2.pm 28 Sep 2002 04:56:26 -0000 1.13
--- Accounts2.pm 5 Oct 2002 09:48:03 -0000 1.14
***************
*** 22,26 ****
require Exporter;
use DBI;
! use C4::Database;
use C4::Stats;
use C4::Search;
--- 22,26 ----
require Exporter;
use DBI;
! use C4::Context;
use C4::Stats;
use C4::Search;
***************
*** 81,85 ****
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data)=@_;
! my $dbh=C4Connect;
my $updquery = "";
my $newamtos = 0;
--- 81,85 ----
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data)=@_;
! my $dbh = C4::Context->dbh;
my $updquery = "";
my $newamtos = 0;
***************
*** 127,131 ****
UpdateStats($env,$branch,'payment',$data,'','','',$bornumber);
$sth->finish;
- $dbh->disconnect;
}
--- 127,130 ----
***************
*** 153,157 ****
my ($bornumber,$accountno,$amount,$user)=@_;
my $env;
! my $dbh=C4Connect;
# begin transaction
my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
--- 152,156 ----
my ($bornumber,$accountno,$amount,$user)=@_;
my $env;
! my $dbh = C4::Context->dbh;
# begin transaction
my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
***************
*** 189,193 ****
UpdateStats($env,$user,'payment',$amount,'','','',$bornumber);
$sth->finish;
- $dbh->disconnect;
#check to see what accounttype
if ($data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L'){
--- 188,191 ----
***************
*** 234,238 ****
sub fixaccounts {
my ($borrowernumber,$accountno,$amount)=@_;
! my $dbh=C4Connect;
my $query="Select * from accountlines where borrowernumber=$borrowernumber
and accountno=$accountno";
--- 232,236 ----
sub fixaccounts {
my ($borrowernumber,$accountno,$amount)=@_;
! my $dbh = C4::Context->dbh;
my $query="Select * from accountlines where borrowernumber=$borrowernumber
and accountno=$accountno";
***************
*** 244,247 ****
--- 242,246 ----
my $outstanding=$data->{'amountoutstanding'}+$diff;
$sth->finish;
+ # FIXME - Use $dbh->do();
$query="Update accountlines set amount='$amount',amountoutstanding='$outstanding' where
borrowernumber=$borrowernumber and accountno=$accountno";
***************
*** 250,254 ****
$sth->execute;
$sth->finish;
- $dbh->disconnect;
}
--- 249,252 ----
***************
*** 256,260 ****
sub returnlost{
my ($borrnum,$itemnum)=@_;
! my $dbh=C4Connect;
my $borrower=borrdata('',$borrnum); #from C4::Search;
my $upiss="Update issues set returndate=now() where
--- 254,258 ----
sub returnlost{
my ($borrnum,$itemnum)=@_;
! my $dbh = C4::Context->dbh;
my $borrower=borrdata('',$borrnum); #from C4::Search;
my $upiss="Update issues set returndate=now() where
***************
*** 266,274 ****
my $date = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $bor="$borrower->{'firstname'} $borrower->{'surname'} $borrower->{'cardnumber'}";
my $upitem="Update items set paidfor='Paid for by $bor $date' where itemnumber='$itemnum'";
$sth=$dbh->prepare($upitem);
$sth->execute;
$sth->finish;
- $dbh->disconnect;
}
--- 264,272 ----
my $date = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];
my $bor="$borrower->{'firstname'} $borrower->{'surname'} $borrower->{'cardnumber'}";
+ # FIXME - Use $dbh->do();
my $upitem="Update items set paidfor='Paid for by $bor $date' where itemnumber='$itemnum'";
$sth=$dbh->prepare($upitem);
$sth->execute;
$sth->finish;
}
***************
*** 290,294 ****
sub manualinvoice{
my ($bornum,$itemnum,$desc,$type,$amount,$user)=@_;
! my $dbh=C4Connect;
my $insert;
$itemnum=~ s/ //g;
--- 288,292 ----
sub manualinvoice{
my ($bornum,$itemnum,$desc,$type,$amount,$user)=@_;
! my $dbh = C4::Context->dbh;
my $insert;
$itemnum=~ s/ //g;
***************
*** 318,325 ****
--- 316,325 ----
$desc.=" ".$itemnum;
$desc=$dbh->quote($desc);
+ # FIXME - Use $dbh->do();
$insert="insert into accountlines (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
values ($bornum,$accountno,now(),'$amount',$desc,'$type','$amountleft','$data->{'itemnumber'}')";
} else {
$desc=$dbh->quote($desc);
+ # FIXME - Use $dbh->do();
$insert="insert into accountlines (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding)
values ($bornum,$accountno,now(),'$amount',$desc,'$type','$amountleft')";
***************
*** 329,334 ****
$sth->execute;
$sth->finish;
-
- $dbh->disconnect;
}
--- 329,332 ----
***************
*** 341,345 ****
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data,$barcode,$type,$user)=@_;
! my $dbh=C4Connect;
my $updquery = "";
my $newamtos = 0;
--- 339,343 ----
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data,$barcode,$type,$user)=@_;
! my $dbh = C4::Context->dbh;
my $updquery = "";
my $newamtos = 0;
***************
*** 416,420 ****
}
$sth->finish;
- $dbh->disconnect;
$env->{'branch'}=$user;
$type="Credit ".$type;
--- 414,417 ----
***************
*** 429,433 ****
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data)=@_;
! my $dbh=C4Connect;
my $updquery = "";
my $newamtos = 0;
--- 426,430 ----
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data)=@_;
! my $dbh = C4::Context->dbh;
my $updquery = "";
my $newamtos = 0;
***************
*** 470,474 ****
}
$sth->finish;
- $dbh->disconnect;
return($amountleft);
}
--- 467,470 ----
More information about the Koha-cvs
mailing list