koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Accounts.pm,1.12,1.13


From: MJ Ray
Subject: [Koha-cvs] CVS: koha/C4 Accounts.pm,1.12,1.13
Date: Mon, 15 Dec 2003 08:18:47 -0800

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv27300/C4

Modified Files:
        Accounts.pm 
Log Message:
DBI call fix for bug 662

Index: Accounts.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Accounts.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** Accounts.pm 19 Feb 2003 01:33:52 -0000      1.12
--- Accounts.pm 15 Dec 2003 16:18:45 -0000      1.13
***************
*** 1,5 ****
  package C4::Accounts; #assumes C4/Accounts
  
! # This module uses the CDK modules, and crashes if called from a web script
  # Hence the existence of Accounts2
  #
--- 1,5 ----
  package C4::Accounts; #assumes C4/Accounts
  
! # FIXME: This module uses the CDK modules, and crashes if called from a web 
script
  # Hence the existence of Accounts2
  #
***************
*** 33,38 ****
  use C4::Search;
  use C4::Stats;
! use C4::InterfaceCDK;
! use C4::Interface::AccountsCDK;
  use vars qw($VERSION @ISA @EXPORT);
  
--- 33,38 ----
  use C4::Search;
  use C4::Stats;
! #use C4::InterfaceCDK;
! #use C4::Interface::AccountsCDK;
  use vars qw($VERSION @ISA @EXPORT);
  
***************
*** 157,161 ****
    #here we update both the accountoffsets and the account lines
    my ($env,$bornumber,$dbh,$data)address@hidden;
-   my $updquery = "";
    my $newamtos = 0;
    my $accdata = "";
--- 157,160 ----
***************
*** 166,174 ****
    my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
    # get lines with outstanding amounts to offset
!   my $query = "select * from accountlines
!   where (borrowernumber = '$bornumber') and (amountoutstanding<>0)
!   order by date";
!   my $sth = $dbh->prepare($query);
!   $sth->execute;
    # offset transactions
    while (($accdata=$sth->fetchrow_hashref) and ($amountleft>0)){
--- 165,172 ----
    my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
    # get lines with outstanding amounts to offset
!   my $sth = $dbh->prepare("select * from accountlines
!   where (borrowernumber = ?) and (amountoutstanding<>0)
!   order by date");
!   $sth->execute($bornumber);
    # offset transactions
    while (($accdata=$sth->fetchrow_hashref) and ($amountleft>0)){
***************
*** 181,196 ****
       }
       my $thisacct = $accdata->{accountno};
!      $updquery = "update accountlines set amountoutstanding= '$newamtos'
!      where (borrowernumber = '$bornumber') and (accountno='$thisacct')";
!      my $usth = $dbh->prepare($updquery);
!      $usth->execute;
       $usth->finish;
       
!      $updquery = "insert into accountoffsets
       (borrowernumber, accountno, offsetaccount,  offsetamount)
!      values ($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos)";
!      $usth = $dbh->prepare($updquery);
  #     print $updquery
!      $usth->execute;
       $usth->finish;
    }
--- 179,192 ----
       }
       my $thisacct = $accdata->{accountno};
!      my $usth = $dbh->prepare("update accountlines set amountoutstanding= ?
!      where (borrowernumber = ?) and (accountno=?)");
!      $usth->execute($newamtos,$bornumber,$thisacct);
       $usth->finish;
       
!      $usth = $dbh->prepare("insert into accountoffsets
       (borrowernumber, accountno, offsetaccount,  offsetamount)
!      values (?,?,?,?)");
  #     print $updquery
!      
$usth->execute($bornumber,$accdata->{'accountno'},$nextaccntno,$newamtos);
       $usth->finish;
    }
***************
*** 200,209 ****
    #($bornumber,$nextaccntno,datetime('now'::abstime),0-$data,'Payment,thanks',
    #'Pay',0-$amountleft)";
!   $updquery = "insert into accountlines
    (borrowernumber, 
accountno,date,amount,description,accounttype,amountoutstanding)
!   values ($bornumber,$nextaccntno,now(),0-$data,'Payment,thanks',
!   'Pay',0-$amountleft)";
!   $usth = $dbh->prepare($updquery);
!   $usth->execute;
    $usth->finish;
    UpdateStats($env,'branch','payment',$data)
--- 196,203 ----
    #($bornumber,$nextaccntno,datetime('now'::abstime),0-$data,'Payment,thanks',
    #'Pay',0-$amountleft)";
!   my $usth = $dbh->prepare("insert into accountlines
    (borrowernumber, 
accountno,date,amount,description,accounttype,amountoutstanding)
!   values (?,?,now(),?,?,'Payment,thanks','Pay')");
!   $usth->execute($bornumber,$nextaccntno,0-$data,0-$amountleft);
    $usth->finish;
    UpdateStats($env,'branch','payment',$data)
***************
*** 227,232 ****
    my $nextaccntno = 1;
    
!   my $query = "select max(accountno)+1 from accountlines";
!   my $sth = $dbh->prepare($query);
    $sth->execute;
    if (my $accdata=$sth->fetchrow_hashref){
--- 221,225 ----
    my $nextaccntno = 1;
    
!   my $sth = $dbh->prepare("select max(accountno)+1 from accountlines");
    $sth->execute;
    if (my $accdata=$sth->fetchrow_hashref){




reply via email to

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