koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 Accounts2.pm,1.23,1.24


From: Mason James
Subject: [Koha-cvs] CVS: koha/C4 Accounts2.pm,1.23,1.24
Date: Thu, 18 Aug 2005 14:15:22 -0700

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32387

Modified Files:
        Accounts2.pm 
Log Message:
UpdateStats is now being passed $accountno. 


Index: Accounts2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Accounts2.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** Accounts2.pm        20 Jun 2005 14:10:00 -0000      1.23
--- Accounts2.pm        18 Aug 2005 21:15:20 -0000      1.24
***************
*** 29,34 ****
  
  # set the version for version checking
! $VERSION = 0.01;      # FIXME - Should probably be different from
!                       # the version for C4::Accounts
  
  =head1 NAME
--- 29,34 ----
  
  # set the version for version checking
! $VERSION = 0.01;        # FIXME - Should probably be different from
!                         # the version for C4::Accounts
  
  =head1 NAME
***************
*** 81,88 ****
--- 81,90 ----
    #here we update both the accountoffsets and the account lines
    my ($env,$bornumber,$data)address@hidden;
+     warn "in accounts2.pm";
    my $dbh = C4::Context->dbh;
    my $newamtos = 0;
    my $accdata = "";
    my $branch=$env->{'branchcode'};
+     warn $branch;
    my $amountleft = $data;
    # begin transaction
***************
*** 97,104 ****
       if ($accdata->{'amountoutstanding'} < $amountleft) {
          $newamtos = 0;
!       $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!       $amountleft = 0;
       }
       my $thisacct = $accdata->{accountno};
--- 99,106 ----
       if ($accdata->{'amountoutstanding'} < $amountleft) {
          $newamtos = 0;
!         $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!         $amountleft = 0;
       }
       my $thisacct = $accdata->{accountno};
***************
*** 144,152 ****
    #updated to check, if they are paying off a lost item, we return the item
    # from their card, and put a note on the item record
!   my ($bornumber,$accountno,$amount,$user)address@hidden;
!   my $env;
    my $dbh = C4::Context->dbh;
    # begin transaction
!   my $nextaccntno = getnextacctno($env,$bornumber,$dbh);
    my $newamtos=0;
    my $sth=$dbh->prepare("Select * from accountlines where  borrowernumber=? 
and accountno=?");
--- 146,155 ----
    #updated to check, if they are paying off a lost item, we return the item
    # from their card, and put a note on the item record
!   my ($bornumber,$accountno,$amount,$user,$branch)address@hidden;
!   my %env;
!   $env{'branchcode'}=$branch;
    my $dbh = C4::Context->dbh;
    # begin transaction
!   my $nextaccntno = getnextacctno(\%env,$bornumber,$dbh);
    my $newamtos=0;
    my $sth=$dbh->prepare("Select * from accountlines where  borrowernumber=? 
and accountno=?");
***************
*** 156,171 ****
  
    $dbh->do(<<EOT);
!       UPDATE  accountlines
!       SET     amountoutstanding = 0
!       WHERE   borrowernumber = $bornumber
!         AND   accountno = $accountno
  EOT
  
  #  print $updquery;
    $dbh->do(<<EOT);
!       INSERT INTO     accountoffsets
!                       (borrowernumber, accountno, offsetaccount,
!                        offsetamount)
!       VALUES          ($bornumber, $accountno, $nextaccntno, $newamtos)
  EOT
  
--- 159,174 ----
  
    $dbh->do(<<EOT);
!         UPDATE  accountlines
!         SET     amountoutstanding = 0
!         WHERE   borrowernumber = $bornumber
!           AND   accountno = $accountno
  EOT
  
  #  print $updquery;
    $dbh->do(<<EOT);
!         INSERT INTO     accountoffsets
!                         (borrowernumber, accountno, offsetaccount,
!                          offsetamount)
!         VALUES          ($bornumber, $accountno, $nextaccntno, $newamtos)
  EOT
  
***************
*** 173,186 ****
    my $payment=0-$amount;
    $dbh->do(<<EOT);
!       INSERT INTO     accountlines
!                       (borrowernumber, accountno, date, amount,
!                        description, accounttype, amountoutstanding)
!       VALUES          ($bornumber, $nextaccntno, now(), $payment,
!                       'Payment,thanks - $user', 'Pay', 0)
  EOT
  
    # FIXME - The second argument to &UpdateStats is supposed to be the
    # branch code.
!   UpdateStats($env,$user,'payment',$amount,'','','',$bornumber);
    $sth->finish;
    #check to see what accounttype
--- 176,190 ----
    my $payment=0-$amount;
    $dbh->do(<<EOT);
!         INSERT INTO     accountlines
!                         (borrowernumber, accountno, date, amount,
!                          description, accounttype, amountoutstanding)
!         VALUES          ($bornumber, $nextaccntno, now(), $payment,
!                         'Payment,thanks - $user', 'Pay', 0)
  EOT
  
    # FIXME - The second argument to &UpdateStats is supposed to be the
    # branch code.
!   # UpdateStats is now being passed $accountno too. MTJ
!   UpdateStats(\%env,$user,'payment',$amount,'','','',$bornumber,$accountno);
    $sth->finish;
    #check to see what accounttype
***************
*** 232,236 ****
    $sth->execute($borrowernumber,$accountno);
    my $data=$sth->fetchrow_hashref;
!       # FIXME - Error-checking
    my $diff=$amount-$data->{'amount'};
    my $outstanding=$data->{'amountoutstanding'}+$diff;
--- 236,240 ----
    $sth->execute($borrowernumber,$accountno);
    my $data=$sth->fetchrow_hashref;
!         # FIXME - Error-checking
    my $diff=$amount-$data->{'amount'};
    my $outstanding=$data->{'amountoutstanding'}+$diff;
***************
*** 238,246 ****
  
    $dbh->do(<<EOT);
!       UPDATE  accountlines
!       SET     amount = '$amount',
!               amountoutstanding = '$outstanding'
!       WHERE   borrowernumber = $borrowernumber
!         AND   accountno = $accountno
  EOT
   }
--- 242,250 ----
  
    $dbh->do(<<EOT);
!         UPDATE  accountlines
!         SET     amount = '$amount',
!                 amountoutstanding = '$outstanding'
!         WHERE   borrowernumber = $borrowernumber
!           AND   accountno = $accountno
  EOT
   }
***************
*** 289,293 ****
    if ($type eq 'CS' || $type eq 'CB' || $type eq 'CW'
    || $type eq 'CF' || $type eq 'CL'){
!     my $amount2=$amount*-1;   # FIXME - $amount2 = -$amount
      $amountleft=fixcredit(\%env,$bornum,$amount2,$itemnum,$type,$user);
    }
--- 293,297 ----
    if ($type eq 'CS' || $type eq 'CB' || $type eq 'CW'
    || $type eq 'CF' || $type eq 'CL'){
!     my $amount2=$amount*-1;     # FIXME - $amount2 = -$amount
      $amountleft=fixcredit(\%env,$bornum,$amount2,$itemnum,$type,$user);
    }
***************
*** 302,315 ****
    }
    if ($itemnum ne ''){
      $desc.=" ".$itemnum;
!     my $sth=$dbh->prepare("INSERT INTO        accountlines
!                       (borrowernumber, accountno, date, amount, description, 
accounttype, amountoutstanding, itemnumber)
!       VALUES (?, ?, now(), ?,?, ?,?,?)");
  #     $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft, 
$data->{'itemnumber'});
       $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft, 
$itemnum);
    } else {
!     my $sth=$dbh->prepare("INSERT INTO        accountlines
!                       (borrowernumber, accountno, date, amount, description, 
accounttype, amountoutstanding)
!                       VALUES (?, ?, now(), ?, ?, ?, ?)");
      $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft);
    }
--- 306,325 ----
    }
    if ($itemnum ne ''){
+ #FIXME to use ? before uncommenting
+ #     my $sth=$dbh->prepare("Select * from items where barcode='$itemnum'");
+ #     $sth->execute;
+ #     my $data=$sth->fetchrow_hashref;
+ #     $sth->finish;
      $desc.=" ".$itemnum;
!     my $sth=$dbh->prepare("INSERT INTO  accountlines
!                         (borrowernumber, accountno, date, amount, 
description, accounttype, amountoutstanding, itemnumber)
!         VALUES (?, ?, now(), ?,?, ?,?,?)");
  #     $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft, 
$data->{'itemnumber'});
       $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft, 
$itemnum);
    } else {
!     $desc=$dbh->quote($desc);
!     my $sth=$dbh->prepare("INSERT INTO  accountlines
!                         (borrowernumber, accountno, date, amount, 
description, accounttype, amountoutstanding)
!                         VALUES (?, ?, now(), ?, ?, ?, ?)");
      $sth->execute($bornum, $accountno, $amount, $desc, $type, $amountleft);
    }
***************
*** 348,355 ****
      if ($accdata->{'amountoutstanding'} < $amountleft) {
          $newamtos = 0;
!       $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!       $amountleft = 0;
       }
            my $thisacct = $accdata->{accountno};
--- 358,365 ----
      if ($accdata->{'amountoutstanding'} < $amountleft) {
          $newamtos = 0;
!         $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!         $amountleft = 0;
       }
            my $thisacct = $accdata->{accountno};
***************
*** 376,383 ****
       if ($accdata->{'amountoutstanding'} < $amountleft) {
          $newamtos = 0;
!       $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!       $amountleft = 0;
       }
       my $thisacct = $accdata->{accountno};
--- 386,393 ----
       if ($accdata->{'amountoutstanding'} < $amountleft) {
          $newamtos = 0;
!         $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!         $amountleft = 0;
       }
       my $thisacct = $accdata->{accountno};
***************
*** 423,430 ****
       if ($accdata->{'amountoutstanding'} > $amountleft) {
          $newamtos = 0;
!       $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!       $amountleft = 0;
       }
  #     print $amountleft;
--- 433,440 ----
       if ($accdata->{'amountoutstanding'} > $amountleft) {
          $newamtos = 0;
!         $amountleft -= $accdata->{'amountoutstanding'};
       }  else {
          $newamtos = $accdata->{'amountoutstanding'} - $amountleft;
!         $amountleft = 0;
       }
  #     print $amountleft;
***************
*** 456,457 ****
--- 466,468 ----
  
  =cut
+ 




reply via email to

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