freeside/FS/FS/ClientAPI MyAccount.pm,1.26,1.27

ivan ivan at pouncequick.420.am
Sat Jul 10 07:46:20 PDT 2004


Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory pouncequick:/tmp/cvs-serv20344

Modified Files:
	MyAccount.pm 
Log Message:
fix edge case avoiding erronous decline/cancel when customer has a negative balance & purchases stuff with it

Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- MyAccount.pm	10 Jul 2004 14:31:00 -0000	1.26
+++ MyAccount.pm	10 Jul 2004 14:46:17 -0000	1.27
@@ -555,7 +555,8 @@
     $cust_main->apply_credits;
     $bill_error = $cust_main->collect;
 
-    if ( $cust_main->balance > $old_balance
+    if (    $cust_main->balance > $old_balance
+         && $cust_main->balance > 0
          && $cust_main->payby !~ /^(BILL|DCRD|DCHK)$/ ) {
       #this makes sense.  credit is "un-doing" the invoice
       $cust_main->credit( sprintf("%.2f", $cust_main->balance - $old_balance ),
@@ -563,7 +564,7 @@
       $cust_main->apply_credits( 'order' => 'newest' );
 
       $cust_pkg->cancel('quiet'=>1);
-      return { 'error' => '_decline' };
+      return { 'error' => '_decline', 'bill_error' => $bill_error };
     } else {
       $cust_pkg->reexport;
     }




More information about the freeside-commits mailing list