[freeside-commits] branch FREESIDE_4_BRANCH updated. 83ec1a32d5671d1f426da6d5732fdd37169816c6

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


The branch, FREESIDE_4_BRANCH has been updated
       via  83ec1a32d5671d1f426da6d5732fdd37169816c6 (commit)
      from  78908b703c8a24a89fabbcd7d8fb38a4175a859d (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 83ec1a32d5671d1f426da6d5732fdd37169816c6
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Oct 26 18:01:01 2015 -0700

    calculate in_transit_payments correctly for partially complete batches, #37193

diff --git a/FS/FS/cust_main/Billing_Batch.pm b/FS/FS/cust_main/Billing_Batch.pm
index c2416ab..2f68d7f 100644
--- a/FS/FS/cust_main/Billing_Batch.pm
+++ b/FS/FS/cust_main/Billing_Batch.pm
@@ -48,7 +48,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
@@ -206,6 +212,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/Billing_Batch.pm |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list