koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/sec writeoff.pl,1.6,1.6.2.1


From: MJ Ray
Subject: [Koha-cvs] CVS: koha/sec writeoff.pl,1.6,1.6.2.1
Date: Wed, 17 Dec 2003 14:21:49 -0800

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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]