Permalink
Browse files

Merged with arensb-context branch: use C4::Context->dbh instead of

&C4Connect, and generally prefer C4::Context over C4::Database.
  • Loading branch information...
arensb
arensb committed Oct 5, 2002
1 parent 7e1bad9 commit dbca39823f826d5e8d1cd7c0fc8d768be1f57b64
Showing with 1,079 additions and 1,172 deletions.
  1. +3 −3 C4/Accounts.pm
  2. +12 −16 C4/Accounts2.pm
  3. +104 −121 C4/Acquisitions.pm
  4. +3 −2 C4/Auth.pm
  5. +111 −65 C4/Biblio.pm
  6. +10 −2 C4/BookShelves.pm
  7. +36 −72 C4/Catalogue.pm
  8. +2 −1 C4/Circmain.pm
  9. +0 −1 C4/Circulation.pm
  10. +4 −3 C4/Circulation/Borrissues.pm
  11. +10 −9 C4/Circulation/Borrower.pm
  12. +26 −29 C4/Circulation/Circ2.pm
  13. +7 −11 C4/Circulation/Fines.pm
  14. +13 −8 C4/Circulation/Issues.pm
  15. +12 −6 C4/Circulation/Main.pm
  16. +2 −1 C4/Circulation/Renewals.pm
  17. +7 −8 C4/Circulation/Renewals2.pm
  18. +4 −3 C4/Circulation/Returns.pm
  19. +10 −21 C4/Database.pm
  20. +3 −4 C4/Groups.pm
  21. +4 −0 C4/InterfaceCDK.pm
  22. +4 −7 C4/Koha.pm
  23. +10 −13 C4/Maintainance.pm
  24. +4 −12 C4/Output.pm
  25. +1 −0 C4/Print.pm
  26. +4 −7 C4/Reserves.pm
  27. +27 −28 C4/Reserves2.pm
  28. +40 −63 C4/Search.pm
  29. +2 −3 C4/Security.pm
  30. +7 −1 C4/SimpleMarc.pm
  31. +11 −21 C4/Stats.pm
  32. +2 −3 C4/Stock.pm
  33. +3 −2 C4/test.pl
  34. +188 −0 ChangeLog
  35. +0 −1 acqui.simple/addbooks.pl
  36. +4 −4 acqui.simple/addbookslccn.pl
  37. +9 −10 acqui.simple/bulkmarcimport.pl
  38. +16 −19 acqui.simple/marcimport.pl
  39. +4 −4 acqui.simple/processz3950queue
  40. +3 −3 acqui.simple/viewmarc.pl
  41. +5 −7 acqui/acquire.pl
  42. +5 −7 acqui/newbiblio.pl
  43. +7 −8 admin/aqbookfund.pl
  44. +8 −9 admin/aqbudget.pl
  45. +8 −13 admin/branches.pl
  46. +8 −8 admin/categorie.pl
  47. +8 −8 admin/categoryitem.pl
  48. +8 −8 admin/currency.pl
  49. +8 −8 admin/itemtypes.pl
  50. +7 −8 admin/marctagstructure.pl
  51. +7 −8 admin/printers.pl
  52. +7 −8 admin/stopwords.pl
  53. +7 −8 admin/systempreferences.pl
  54. +7 −11 bookcount.pl
  55. +2 −2 charges.pl
  56. +2 −2 circ/circulation.pl
  57. +7 −6 deletemem.pl
  58. +3 −24 detail.pl
  59. +2 −4 fixBranches.pl
  60. +32 −56 html-template/Search.pm
  61. +4 −25 html-template/detail.pl
  62. +4 −25 html-template/moredetail.pl
  63. +12 −29 html-template/search.pl
  64. +2 −3 insertdata.pl
  65. +2 −3 insertidata.pl
  66. +2 −3 insertjdata.pl
  67. +2 −2 logout.pl
  68. +0 −1 maint/catmaintain.pl
  69. +3 −3 maint/shiftbib.pl
  70. +8 −31 marc/MARCdetail.pl
  71. +3 −2 marc/fill_usmarc.pl
  72. +2 −6 marc/koha2marc
  73. +3 −7 marc/test
  74. +2 −4 marc/updatedb2marc.pl
  75. +13 −3 marc/viewmarc.pl
  76. +2 −3 memberentry.pl
  77. +3 −5 misc/fines2.pl
  78. +15 −17 misc/fixborrower.pl
  79. +2 −5 misc/fixcatalog.pl
  80. +2 −5 misc/fixorders.pl
  81. +2 −5 misc/fixrefs.pl
  82. +2 −4 misc/makebaskets.pl
  83. +2 −5 misc/makeformats.pl
  84. +0 −1 misc/tidyaccounts.pl
  85. +4 −25 moredetail.pl
  86. +2 −4 moremember.pl
  87. +4 −3 overdue.pl
  88. +3 −4 pay.pl
  89. +7 −26 search.pl
  90. +2 −3 sec/writeoff.pl
  91. +4 −5 stats2.pl
  92. +27 −29 telnet/borrwraper.pl
  93. +29 −30 telnet/doreturns.pl
  94. +2 −2 thesaurus_popup.pl
  95. +0 −1 tidyaccounts.pl
  96. +0 −1 updatebibitem.pl
  97. +0 −1 updatebiblio.pl
  98. +2 −3 updatecharges.pl
  99. +4 −5 updateitem.pl
  100. +3 −2 updater/thesaurus_create.pl
  101. +16 −3 updater/updatedatabase
  102. +4 −3 updater/updatedatabase2.pl
  103. +4 −25 userpage.pl
View
@@ -21,7 +21,7 @@ package C4::Accounts; #assumes C4/Accounts
use strict;
require Exporter;
use DBI;
-use C4::Database;
+use C4::Context;
use C4::Format;
use C4::Search;
use C4::Stats;
@@ -103,7 +103,7 @@ sub checkaccount {
sub reconcileaccount {
#print put money owing give person opportunity to pay it off
my ($env,$dummy,$bornumber,$total)=@_;
- my $dbh = &C4Connect;
+ my $dbh = C4::Context->dbh;
#get borrower record
my $sth=$dbh->prepare("select * from borrowers
where borrowernumber=$bornumber");
@@ -144,7 +144,6 @@ sub reconcileaccount {
#Check if the borrower still owes
$total=&checkaccount($env,$bornumber,$dbh);
}
- $dbh->disconnect;
return($total);
}
@@ -186,6 +185,7 @@ sub recordpayment{
$updquery = "insert into accountoffsets
(borrowernumber, accountno, offsetaccount, offsetamount)
values ($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos)";
+ # FIXME - There's already a $usth in this scope.
my $usth = $dbh->prepare($updquery);
# print $updquery
$usth->execute;
View
@@ -21,7 +21,7 @@ package C4::Accounts2; #assumes C4/Accounts2
use strict;
require Exporter;
use DBI;
-use C4::Database;
+use C4::Context;
use C4::Stats;
use C4::Search;
use C4::Circulation::Circ2;
@@ -80,7 +80,7 @@ will be credited to the next one.
sub recordpayment{
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data)=@_;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
my $updquery = "";
my $newamtos = 0;
my $accdata = "";
@@ -126,7 +126,6 @@ sub recordpayment{
$usth->finish;
UpdateStats($env,$branch,'payment',$data,'','','',$bornumber);
$sth->finish;
- $dbh->disconnect;
}
=item makepayment
@@ -152,7 +151,7 @@ sub makepayment{
# from their card, and put a note on the item record
my ($bornumber,$accountno,$amount,$user)=@_;
my $env;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
# begin transaction
my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
my $newamtos=0;
@@ -188,7 +187,6 @@ sub makepayment{
# branch code.
UpdateStats($env,$user,'payment',$amount,'','','',$bornumber);
$sth->finish;
- $dbh->disconnect;
#check to see what accounttype
if ($data->{'accounttype'} eq 'Rep' || $data->{'accounttype'} eq 'L'){
returnlost($bornumber,$data->{'itemnumber'});
@@ -233,7 +231,7 @@ sub getnextacctno {
# FIXME - I don't understand what this function does.
sub fixaccounts {
my ($borrowernumber,$accountno,$amount)=@_;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
my $query="Select * from accountlines where borrowernumber=$borrowernumber
and accountno=$accountno";
my $sth=$dbh->prepare($query);
@@ -243,19 +241,19 @@ sub fixaccounts {
my $diff=$amount-$data->{'amount'};
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";
$sth=$dbh->prepare($query);
# print $query;
$sth->execute;
$sth->finish;
- $dbh->disconnect;
}
# FIXME - Never used, but not exported, either.
sub returnlost{
my ($borrnum,$itemnum)=@_;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
my $borrower=borrdata('',$borrnum); #from C4::Search;
my $upiss="Update issues set returndate=now() where
borrowernumber='$borrnum' and itemnumber='$itemnum' and returndate is null";
@@ -265,11 +263,11 @@ sub returnlost{
my @datearr = localtime(time);
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;
- $dbh->disconnect;
}
=item manualinvoice
@@ -289,7 +287,7 @@ should be the empty string.
# FIXME - Okay, so what does this function do, really?
sub manualinvoice{
my ($bornum,$itemnum,$desc,$type,$amount,$user)=@_;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
my $insert;
$itemnum=~ s/ //g;
my %env;
@@ -317,19 +315,19 @@ sub manualinvoice{
$sth->finish;
$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')";
}
my $sth=$dbh->prepare($insert);
$sth->execute;
$sth->finish;
-
- $dbh->disconnect;
}
# fixcredit
@@ -340,7 +338,7 @@ sub manualinvoice{
sub fixcredit{
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data,$barcode,$type,$user)=@_;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
my $updquery = "";
my $newamtos = 0;
my $accdata = "";
@@ -415,7 +413,6 @@ sub fixcredit{
$usth->finish;
}
$sth->finish;
- $dbh->disconnect;
$env->{'branch'}=$user;
$type="Credit ".$type;
UpdateStats($env,$user,$type,$data,$user,'','',$bornumber);
@@ -428,7 +425,7 @@ sub fixcredit{
sub refund{
#here we update both the accountoffsets and the account lines
my ($env,$bornumber,$data)=@_;
- my $dbh=C4Connect;
+ my $dbh = C4::Context->dbh;
my $updquery = "";
my $newamtos = 0;
my $accdata = "";
@@ -469,7 +466,6 @@ sub refund{
$usth->finish;
}
$sth->finish;
- $dbh->disconnect;
return($amountleft);
}
Oops, something went wrong.

0 comments on commit dbca398

Please sign in to comment.