[Koha-cvs] CVS: koha/C4/Circulation Renewals.pm,1.5,1.6
MJ Ray
slef at users.sourceforge.net
Wed Dec 3 13:05:43 CET 2003
Update of /cvsroot/koha/koha/C4/Circulation
In directory sc8-pr-cvs1:/tmp/cvs-serv12447/C4/Circulation
Modified Files:
Renewals.pm
Log Message:
DBI changes fixing bug 662
Index: Renewals.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Circulation/Renewals.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** Renewals.pm 13 Oct 2002 11:37:30 -0000 1.5
--- Renewals.pm 3 Dec 2003 12:05:40 -0000 1.6
***************
*** 102,111 ****
# Look in the issues table for this item, lent to this borrower,
# and not yet returned.
! my $q1 = "select * from issues
where (borrowernumber = '$bornum')
and (itemnumber = '$itemno')
! and returndate is null";
! my $sth1 = $dbh->prepare($q1);
! $sth1->execute;
# Found a matching item
if (my $data1 = $sth1->fetchrow_hashref) {
--- 102,110 ----
# Look in the issues table for this item, lent to this borrower,
# and not yet returned.
! my $sth1 = $dbh->prepare("select * from issues
where (borrowernumber = '$bornum')
and (itemnumber = '$itemno')
! and returndate is null");
! $sth1->execute($bornum,$itemno);
# Found a matching item
if (my $data1 = $sth1->fetchrow_hashref) {
***************
*** 114,123 ****
# the biblioitem, which gives us the itemtype, which tells us
# whether it may be renewed.
! my $q2 = "select renewalsallowed from items,biblioitems,itemtypes
! where (items.itemnumber = '$itemno')
and (items.biblioitemnumber = biblioitems.biblioitemnumber)
! and (biblioitems.itemtype = itemtypes.itemtype)";
! my $sth2 = $dbh->prepare($q2);
! $sth2->execute;
if (my $data2=$sth2->fetchrow_hashref) {
$renews = $data2->{'renewalsallowed'};
--- 113,121 ----
# the biblioitem, which gives us the itemtype, which tells us
# whether it may be renewed.
! my $sth2 = $dbh->prepare("select renewalsallowed from items,biblioitems,itemtypes
! where (items.itemnumber = ?)
and (items.biblioitemnumber = biblioitems.biblioitemnumber)
! and (biblioitems.itemtype = itemtypes.itemtype)");
! $sth2->execute($itemno);
if (my $data2=$sth2->fetchrow_hashref) {
$renews = $data2->{'renewalsallowed'};
***************
*** 144,153 ****
if ($datedue eq "" ) {
my $loanlength=21;
! my $query= "Select * from biblioitems,items,itemtypes
! where (items.itemnumber = '$itemno')
and (biblioitems.biblioitemnumber = items.biblioitemnumber)
! and (biblioitems.itemtype = itemtypes.itemtype)";
! my $sth=$dbh->prepare($query);
! $sth->execute;
if (my $data=$sth->fetchrow_hashref) {
$loanlength = $data->{'loanlength'}
--- 142,150 ----
if ($datedue eq "" ) {
my $loanlength=21;
! my $sth=$dbh->prepare("Select * from biblioitems,items,itemtypes
! where (items.itemnumber = ?)
and (biblioitems.biblioitemnumber = items.biblioitemnumber)
! and (biblioitems.itemtype = itemtypes.itemtype)");
! $sth->execute($itemno);
if (my $data=$sth->fetchrow_hashref) {
$loanlength = $data->{'loanlength'}
***************
*** 161,178 ****
my @date = split("-",$datedue);
my $odatedue = (@date[2]+0)."-".(@date[1]+0)."-". at date[0];
! my $issquery = "select * from issues where borrowernumber='$bornum' and
! itemnumber='$itemno' and returndate is null";
! my $sth=$dbh->prepare($issquery);
! $sth->execute;
my $issuedata=$sth->fetchrow_hashref;
$sth->finish;
my $renews = $issuedata->{'renewals'} +1;
! my $updquery = "update issues
! set date_due = '$datedue', renewals = '$renews'
! where borrowernumber='$bornum' and
! itemnumber='$itemno' and returndate is null";
! my $sth=$dbh->prepare($updquery);
! $sth->execute;
$sth->finish;
return($odatedue);
--- 158,173 ----
my @date = split("-",$datedue);
my $odatedue = (@date[2]+0)."-".(@date[1]+0)."-". at date[0];
! my $sth=$dbh->prepare("select * from issues where borrowernumber=? and
! itemnumber=? and returndate is null");
! $sth->execute($bornum,$itemno);
my $issuedata=$sth->fetchrow_hashref;
$sth->finish;
my $renews = $issuedata->{'renewals'} +1;
! my $sth=$dbh->prepare("update issues
! set date_due = ?, renewals = ?
! where borrowernumber=? and
! itemnumber=? and returndate is null");
! $sth->execute($datedue,$renews,$bornum,$itemno);
$sth->finish;
return($odatedue);
***************
*** 184,191 ****
sub bulkrenew {
my ($env,$dbh,$bornum,$amount,$borrower,$odues) = @_;
! my $query = "select * from issues
! where borrowernumber = '$bornum' and returndate is null order by date_due";
! my $sth = $dbh->prepare($query);
! $sth->execute();
my @items;
my @issues;
--- 179,184 ----
sub bulkrenew {
my ($env,$dbh,$bornum,$amount,$borrower,$odues) = @_;
! my $sth = $dbh->prepare("select * from issues where borrowernumber = ? and returndate is null order by date_due");
! $sth->execute($bornum);
my @items;
my @issues;
More information about the Koha-cvs
mailing list