summaryrefslogtreecommitdiff
path: root/FS/FS/cust_bill_ApplicationCommon.pm
diff options
context:
space:
mode:
authormark <mark>2011-12-08 21:13:17 +0000
committermark <mark>2011-12-08 21:13:17 +0000
commitce1b61e7d65317a74f680afb4cb8d8306e14fa5f (patch)
tree5adb1b9b7b6afc37ebc03bc29aa32fabb8cb373e /FS/FS/cust_bill_ApplicationCommon.pm
parentd8d63a28503d40743425dceda7e0b744739eeb2a (diff)
promised payment date for invoices, #13554
Diffstat (limited to 'FS/FS/cust_bill_ApplicationCommon.pm')
-rw-r--r--FS/FS/cust_bill_ApplicationCommon.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/FS/FS/cust_bill_ApplicationCommon.pm b/FS/FS/cust_bill_ApplicationCommon.pm
index afb90f4..cadb8a7 100644
--- a/FS/FS/cust_bill_ApplicationCommon.pm
+++ b/FS/FS/cust_bill_ApplicationCommon.pm
@@ -435,6 +435,17 @@ sub apply_to_lineitems {
}
+ # unset promised payment date if there is one
+ my $cust_bill = $self->cust_bill;
+ if ( $cust_bill->promised_date and $cust_bill->owed <= 0 ) {
+ $cust_bill->set('promised_date', '');
+ my $error = $cust_bill->replace;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ }
+
#everything should always be applied to line items in full now... sanity check
$applied = sprintf('%.2f', $applied);
unless ( $applied == $self->amount ) {