[Koha-cvs] CVS: koha/sec writeoff.pl,1.6,1.6.2.1
MJ Ray
slef at users.sourceforge.net
Wed Dec 17 23:21:49 CET 2003
Update of /cvsroot/koha/koha/sec
In directory sc8-pr-cvs1:/tmp/cvs-serv30783/sec
Modified Files:
Tag: rel_2_0
writeoff.pl
Log Message:
DBI call fix for bug 662
Index: writeoff.pl
===================================================================
RCS file: /cvsroot/koha/koha/sec/writeoff.pl,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -r1.6 -r1.6.2.1
*** writeoff.pl 13 Oct 2002 10:46:38 -0000 1.6
--- writeoff.pl 17 Dec 2003 22:21:47 -0000 1.6.2.1
***************
*** 69,92 ****
my $dbh = C4::Context->dbh;
my $env;
! my $query="Update accountlines set amountoutstanding=0 where ";
if ($accounttype eq 'Res'){
! $query.="accounttype='Res' and accountno='$accountnum' and borrowernumber='$bornum'";
} else {
! $query.="accounttype='$accounttype' and itemnumber='$itemnum' and borrowernumber='$bornum'";
}
- my $sth=$dbh->prepare($query);
- # print $query;
- $sth->execute;
$sth->finish;
! $query="select max(accountno) from accountlines";
! $sth=$dbh->prepare($query);
$sth->execute;
my $account=$sth->fetchrow_hashref;
$sth->finish;
$account->{'max(accountno)'}++;
! $query="insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype)
! values ('$bornum','$account->{'max(accountno)'}','$itemnum',now(),'$amount','Writeoff','W')";
! $sth=$dbh->prepare($query);
! $sth->execute;
$sth->finish;
# print $query;
--- 69,89 ----
my $dbh = C4::Context->dbh;
my $env;
! my $sth;
if ($accounttype eq 'Res'){
! $sth=$dbh->prepare("Update accountlines set amountoutstanding=0 where accounttype='Res' and accountno=? and borrowernumber=?");
! $sth->execute($accountnum,$bornum);
} else {
! $sth=$dbh->prepare("Update accountlines set amountoutstanding=0 where accounttype=? and itemnumber=? and borrowernumber=?");
! $sth->execute($accounttype,$itemnum,$bornum);
}
$sth->finish;
! $sth=$dbh->prepare("select max(accountno) from accountlines");
$sth->execute;
my $account=$sth->fetchrow_hashref;
$sth->finish;
$account->{'max(accountno)'}++;
! $sth=$dbh->prepare("insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype)
! values (?,?,?,now(),?,'Writeoff','W')");
! $sth->execute($bornum,$account->{'max(accountno)'},$itemnum,$amount);
$sth->finish;
# print $query;
More information about the Koha-cvs
mailing list