diff options
author | Mark Wells <mark@freeside.biz> | 2015-10-26 18:01:01 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-10-26 18:01:01 -0700 |
commit | 27f72f8225edc0d903ce534613ad037b7baf3bcf (patch) | |
tree | 235387b9b204c00a7f08cbf1be6d4e785cf48350 | |
parent | 434137989f7343ada30ceff4056c5f75ef8d9d27 (diff) |
calculate in_transit_payments correctly for partially complete batches, #37193
-rw-r--r-- | FS/FS/cust_main/Billing_Batch.pm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/FS/FS/cust_main/Billing_Batch.pm b/FS/FS/cust_main/Billing_Batch.pm index 0cf2beeda..cdaf2938f 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}; @@ -218,6 +224,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; } |