Code Cleaning Members.
[koha_gimpoz] / members / pay.pl
index 4b89730..4e4243d 100755 (executable)
@@ -32,10 +32,10 @@ use C4::Auth;
 use C4::Output;
 use CGI;
 use C4::Members;
-use C4::Accounts2;
+use C4::Accounts;
 use C4::Stats;
 use C4::Koha;
-use C4::Circulation::Fines;
+use C4::Overdues;
 use C4::Branch; # GetBranches
 
 my $input = new CGI;
@@ -46,12 +46,10 @@ if ( $borrowernumber eq '' ) {
 }
 
 # get borrower details
-my $data = borrdata( '', $borrowernumber );
+my $data = GetMember( $borrowernumber,'borrowernumber' );
 my $user = $input->remote_user;
 
 # get account details
-my %bor;
-$bor{'borrowernumber'} = $borrowernumber;
 my $branches = GetBranches();
 my $printers = GetPrinters();
 my $branch   = GetBranch( $input, $branches );
@@ -75,9 +73,6 @@ for ( my $i = 0 ; $i < @names ; $i++ ) {
         $check = 2;
     }
 }
-my %env;
-
-$env{'branchcode'} = $branch;
 my $total = $input->param('total');
 if ( $check == 0 ) {
     my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
@@ -91,10 +86,10 @@ if ( $check == 0 ) {
         }
     );
     if ( $total ne '' ) {
-        recordpayment( \%env, $borrowernumber, $total );
+        recordpayment( $borrowernumber, $total );
     }
 
-    my ( $numaccts, $accts, $total ) = getboracctrecord( '', \%bor );
+    my ( $total, $accts, $numaccts) = GetBorrowerAcctRecord( $borrowernumber );
 
 #       creation d'une fonction qui va nous retourner le notify_id dans un tableau
 
@@ -179,7 +174,6 @@ sub writeoff {
     my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount ) = @_;
     my $user = $input->remote_user;
     my $dbh  = C4::Context->dbh;
-    my $env;
     my $sth =
       $dbh->prepare(
 "Update accountlines set amountoutstanding=0 where (accounttype='Res' OR accounttype='FU' OR accounttype ='IP' OR accounttype='CH' OR accounttype='N' OR accounttype='F' OR accounttype='A' OR accounttype='M' OR accounttype='L' OR accounttype='RE' OR accounttype='RL') and accountno=? and borrowernumber=?"
@@ -198,6 +192,6 @@ sub writeoff {
     $sth->execute( $borrowernumber, $account->{'max(accountno)'},
         $itemnum, $amount );
     $sth->finish;
-    UpdateStats( $env, $branch, 'writeoff', $amount, '', '', '',
+    UpdateStats( $branch, 'writeoff', $amount, '', '', '',
         $borrowernumber );
 }