Reverse Payment - Allows any payment to be 'undone' while retaining a record of said...
[koha_ffzg] / members / boraccount.pl
index 40dd68a..6c7fe48 100755 (executable)
@@ -29,6 +29,7 @@ use C4::Dates qw/format_date/;
 use CGI;
 use C4::Members;
 use C4::Branch;
+use C4::Accounts;
 
 my $input=new CGI;
 
@@ -46,6 +47,10 @@ my $borrowernumber=$input->param('borrowernumber');
 #get borrower details
 my $data=GetMember($borrowernumber,'borrowernumber');
 
+if ( $input->param('action') eq 'reverse' ) {
+  ReversePayment( $borrowernumber, $input->param('accountno') );
+}
+
 if ( $data->{'category_type'} eq 'C') {
    my  ( $catcodes, $labels ) =  GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
    my $cnt = scalar(@$catcodes);
@@ -85,7 +90,11 @@ for (my $i=0;$i<$numaccts;$i++){
                                'itemnumber'       => $accts->[$i]{'itemnumber'},
                                'biblionumber'       => $accts->[$i]{'biblionumber'},
                 'amount'            => sprintf("%.2f",$accts->[$i]{'amount'}),
-                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}) );
+                'amountoutstanding' => sprintf("%.2f",$accts->[$i]{'amountoutstanding'}),
+                'accountno' => $accts->[$i]{'accountno'},
+                'payment' => ( $accts->[$i]{'accounttype'} eq 'Pay' ),
+                
+                );
     
     if ($accts->[$i]{'accounttype'} ne 'F' && $accts->[$i]{'accounttype'} ne 'FU'){
         $row{'printtitle'}=1;