[freeside-commits] branch FREESIDE_3_BRANCH updated. 018b487f771a0713a5ee2b8b3f0658d87261dbec

Mark Wells mark at 420.am
Mon Oct 26 18:02:27 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  018b487f771a0713a5ee2b8b3f0658d87261dbec (commit)
      from  638a28282f1b87c59f7e11b4da8ce0754307edc9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 018b487f771a0713a5ee2b8b3f0658d87261dbec
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Oct 26 17:40:56 2015 -0700

    calculate in_transit_payments correctly for partially complete batches, #37193

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index c7f40f2..5691d83 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -2564,7 +2564,13 @@ sub batch_card {
   }else{
     $amount = sprintf("%.2f", $self->balance - $self->in_transit_payments);
   }
-  return '' unless $amount > 0;
+  if ($amount <= 0) {
+    warn(sprintf("Customer balance %.2f - in transit amount %.2f is <= 0.\n",
+        $self->balance,
+        $self->in_transit_payments
+    ));
+    return;
+  }
   
   my $invnum = delete $options{invnum};
   my $payby = $options{payby} || $self->payby;  #still dubious
@@ -2974,6 +2980,7 @@ sub in_transit_payments {
     foreach my $cust_pay_batch ( qsearch('cust_pay_batch', {
       'batchnum' => $pay_batch->batchnum,
       'custnum' => $self->custnum,
+      'status'  => '',
     } ) ) {
       $in_transit_payments += $cust_pay_batch->amount;
     }

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main.pm |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list