[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.37,1.38
From: |
Andrew Arensburger |
Subject: |
[Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.37,1.38 |
Date: |
Sat, 05 Oct 2002 02:54:15 -0700 |
Update of /cvsroot/koha/koha/C4/Circulation
In directory usw-pr-cvs1:/tmp/cvs-serv23368/C4/Circulation
Modified Files:
Circ2.pm
Log Message:
Merged with arensb-context branch: use C4::Context->dbh instead of
&C4Connect, and generally prefer C4::Context over C4::Database.
Index: Circ2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** Circ2.pm 1 Oct 2002 11:51:58 -0000 1.37
--- Circ2.pm 5 Oct 2002 09:54:13 -0000 1.38
***************
*** 26,30 ****
require Exporter;
use DBI;
! use C4::Database;
#use C4::Accounts;
#use C4::InterfaceCDK;
--- 26,30 ----
require Exporter;
use DBI;
! use C4::Context;
#use C4::Accounts;
#use C4::InterfaceCDK;
***************
*** 85,89 ****
# returns a reference to a hash of references to branches...
my %branches;
! my $dbh=&C4Connect;
my $sth=$dbh->prepare("select * from branches");
$sth->execute;
--- 85,89 ----
# returns a reference to a hash of references to branches...
my %branches;
! my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select * from branches");
$sth->execute;
***************
*** 99,103 ****
$branches{$branch->{'branchcode'}}=$branch;
}
- $dbh->disconnect;
return (\%branches);
}
--- 99,102 ----
***************
*** 107,111 ****
my ($env) = @_;
my %printers;
! my $dbh=&C4Connect;
my $sth=$dbh->prepare("select * from printers");
$sth->execute;
--- 106,110 ----
my ($env) = @_;
my %printers;
! my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select * from printers");
$sth->execute;
***************
*** 113,117 ****
$printers{$printer->{'printqueue'}}=$printer;
}
- $dbh->disconnect;
return (\%printers);
}
--- 112,115 ----
***************
*** 122,126 ****
# returns
my ($env, $borrowernumber,$cardnumber) = @_;
! my $dbh=&C4Connect;
my $query;
my $sth;
--- 120,124 ----
# returns
my ($env, $borrowernumber,$cardnumber) = @_;
! my $dbh = C4::Context->dbh;
my $query;
my $sth;
***************
*** 139,143 ****
my $flags = patronflags($env, $borrower, $dbh);
$sth->finish;
- $dbh->disconnect;
$borrower->{'flags'}=$flags;
return($borrower, $flags);
--- 137,140 ----
***************
*** 178,182 ****
# returns a hash of item information given either the itemnumber or the
barcode
my ($env, $itemnumber, $barcode) = @_;
! my $dbh=&C4Connect;
my $sth;
if ($itemnumber) {
--- 175,179 ----
# returns a hash of item information given either the itemnumber or the
barcode
my ($env, $itemnumber, $barcode) = @_;
! my $dbh = C4::Context->dbh;
my $sth;
if ($itemnumber) {
***************
*** 208,212 ****
$sth->finish;
}
- $dbh->disconnect;
return($iteminformation);
}
--- 205,208 ----
***************
*** 216,220 ****
# surname
my ($env, $key) = @_;
! my $dbh=&C4Connect;
my @borrowers;
my $q_key=$dbh->quote($key);
--- 212,216 ----
# surname
my ($env, $key) = @_;
! my $dbh = C4::Context->dbh;
my @borrowers;
my $q_key=$dbh->quote($key);
***************
*** 234,238 ****
}
$sth->finish;
- $dbh->disconnect;
return(address@hidden);
}
--- 230,233 ----
***************
*** 287,291 ****
sub dotransfer {
my ($itm, $fbr, $tbr) = @_;
! my $dbh = &C4Connect;
$itm = $dbh->quote($itm);
$fbr = $dbh->quote($fbr);
--- 282,286 ----
sub dotransfer {
my ($itm, $fbr, $tbr) = @_;
! my $dbh = C4::Context->dbh;
$itm = $dbh->quote($itm);
$fbr = $dbh->quote($fbr);
***************
*** 298,306 ****
$sth->finish;
#update holdingbranch in items .....
$query = "update items set datelastseen = now(), holdingbranch=$tbr where
items.itemnumber=$itm";
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
- $dbh->disconnect;
return;
}
--- 293,301 ----
$sth->finish;
#update holdingbranch in items .....
+ # FIXME - Use $dbh->do()
$query = "update items set datelastseen = now(), holdingbranch=$tbr where
items.itemnumber=$itm";
$sth = $dbh->prepare($query);
$sth->execute;
$sth->finish;
return;
}
***************
*** 309,313 ****
sub issuebook {
my ($env, $patroninformation, $barcode, $responses, $date) = @_;
! my $dbh=&C4Connect;
my $iteminformation = getiteminformation($env, 0, $barcode);
my ($datedue);
--- 304,308 ----
sub issuebook {
my ($env, $patroninformation, $barcode, $responses, $date) = @_;
! my $dbh = C4::Context->dbh;
my $iteminformation = getiteminformation($env, 0, $barcode);
my ($datedue);
***************
*** 486,490 ****
$message=sprintf "Rental charge of \$%.02f applies.",
$iteminformation->{'charge'};
}
- $dbh->disconnect;
return ($iteminformation, $dateduef, $rejected, $question,
$questionnumber, $defaultanswer, $message);
}
--- 481,484 ----
***************
*** 522,526 ****
# update issues, thereby returning book (should push this out into another
subroutine
my ($borrower) = getpatroninformation(\%env, $currentborrower, 0);
! if ($doreturn) {
doreturn($borrower->{'borrowernumber'},
$iteminformation->{'itemnumber'});
$messages->{'WasReturned'};
--- 516,520 ----
# update issues, thereby returning book (should push this out into another
subroutine
my ($borrower) = getpatroninformation(\%env, $currentborrower, 0);
! if ($doreturn) { # FIXME - perl -wc complains about this line.
doreturn($borrower->{'borrowernumber'},
$iteminformation->{'itemnumber'});
$messages->{'WasReturned'};
***************
*** 529,537 ****
# transfer book
my ($transfered, $mess, $item) = transferbook($branch, $barcode, 1);
! if ($transfered) {
$messages->{'WasTransfered'};
}
# fix up the accounts.....
! if ($iteminformation->{'itemlost'}) {
updateitemlost($iteminformation->{'itemnumber'});
fixaccountforlostandreturned($iteminformation, $borrower);
--- 523,531 ----
# transfer book
my ($transfered, $mess, $item) = transferbook($branch, $barcode, 1);
! if ($transfered) { # FIXME - perl -wc complains about this line.
$messages->{'WasTransfered'};
}
# fix up the accounts.....
! if ($iteminformation->{'itemlost'}) { # FIXME - perl -wc complains
about this line.
updateitemlost($iteminformation->{'itemnumber'});
fixaccountforlostandreturned($iteminformation, $borrower);
***************
*** 554,558 ****
sub doreturn {
my ($brn, $itm) = @_;
! my $dbh=&C4Connect;
$brn = $dbh->quote($brn);
$itm = $dbh->quote($itm);
--- 548,552 ----
sub doreturn {
my ($brn, $itm) = @_;
! my $dbh = C4::Context->dbh;
$brn = $dbh->quote($brn);
$itm = $dbh->quote($itm);
***************
*** 566,570 ****
$sth->execute;
$sth->finish;
- $dbh->disconnect;
return;
}
--- 560,563 ----
***************
*** 572,576 ****
sub updateitemlost{
my ($itemno)address@hidden;
! my $dbh=&C4Connect;
my $query="update items set itemlost=0 where itemnumber=$itemno";
my $sth=$dbh->prepare($query);
--- 565,570 ----
sub updateitemlost{
my ($itemno)address@hidden;
! my $dbh = C4::Context->dbh;
! # FIXME - Use $dbh->do();
my $query="update items set itemlost=0 where itemnumber=$itemno";
my $sth=$dbh->prepare($query);
***************
*** 582,586 ****
my ($iteminfo, $borrower) = @_;
my %env;
! my $dbh=&C4Connect;
my $itm = $dbh->quote($iteminfo->{'itemnumber'});
# check for charge made for lost book
--- 576,580 ----
my ($iteminfo, $borrower) = @_;
my %env;
! my $dbh = C4::Context->dbh;
my $itm = $dbh->quote($iteminfo->{'itemnumber'});
# check for charge made for lost book
***************
*** 674,678 ****
sub fixoverduesonreturn {
my ($brn, $itm) = @_;
! my $dbh=&C4Connect;
$itm = $dbh->quote($itm);
$brn = $dbh->quote($brn);
--- 668,672 ----
sub fixoverduesonreturn {
my ($brn, $itm) = @_;
! my $dbh = C4::Context->dbh;
$itm = $dbh->quote($itm);
$brn = $dbh->quote($brn);
***************
*** 786,790 ****
# Original subroutine for Circ2.pm
my ($itemnumber) = @_;
! my $dbh = &C4Connect;
my $q_itemnumber = $dbh->quote($itemnumber);
my $sth=$dbh->prepare("select borrowers.borrowernumber from
--- 780,784 ----
# Original subroutine for Circ2.pm
my ($itemnumber) = @_;
! my $dbh = C4::Context->dbh;
my $q_itemnumber = $dbh->quote($itemnumber);
my $sth=$dbh->prepare("select borrowers.borrowernumber from
***************
*** 845,849 ****
# New subroutine for Circ2.pm
my ($env, $borrower) = @_;
! my $dbh=&C4Connect;
my %currentissues;
my $counter=1;
--- 839,843 ----
# New subroutine for Circ2.pm
my ($env, $borrower) = @_;
! my $dbh = C4::Context->dbh;
my %currentissues;
my $counter=1;
***************
*** 884,894 ****
}
$sth->finish;
- $dbh->disconnect;
return(\%currentissues);
}
sub getissues {
# New subroutine for Circ2.pm
my ($borrower) = @_;
! my $dbh=&C4Connect;
my $borrowernumber = $borrower->{'borrowernumber'};
my $brn =$dbh->quote($borrowernumber);
--- 878,888 ----
}
$sth->finish;
return(\%currentissues);
}
+
sub getissues {
# New subroutine for Circ2.pm
my ($borrower) = @_;
! my $dbh = C4::Context->dbh;
my $borrowernumber = $borrower->{'borrowernumber'};
my $brn =$dbh->quote($borrowernumber);
***************
*** 922,926 ****
}
$sth->finish;
- $dbh->disconnect;
return(\%currentissues);
}
--- 916,919 ----
***************
*** 1048,1051 ****
--- 1041,1048 ----
}
+ # FIXME - This is almost, but not quite, identical to
+ # &C4::Circulation::Issues::calc_charges and
+ # &C4::Circulation::Renewals2::calc_charges.
+ # Pick one and stick with it.
sub calc_charges {
# Stolen from Issues.pm
***************
*** 1120,1124 ****
my ($itemno) = @_;
my %env;
! my $dbh=&C4Connect;
my ($itemdata) = getiteminformation(\%env, $itemno,0);
my $bibno = $dbh->quote($itemdata->{'biblionumber'});
--- 1117,1121 ----
my ($itemno) = @_;
my %env;
! my $dbh = C4::Context->dbh;
my ($itemdata) = getiteminformation(\%env, $itemno,0);
my $bibno = $dbh->quote($itemdata->{'biblionumber'});
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/C4/Circulation Circ2.pm,1.37,1.38,
Andrew Arensburger <=