[freeside-commits] branch FREESIDE_3_BRANCH updated. 4d9a9320ab4b0f28061f4032270785e627c21bb5
Mark Wells
mark at 420.am
Mon Jan 26 18:31:44 PST 2015
The branch, FREESIDE_3_BRANCH has been updated
via 4d9a9320ab4b0f28061f4032270785e627c21bb5 (commit)
from 76a7bc00ed44a8123a5ceb0b57f7b9ad05ae82c4 (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 4d9a9320ab4b0f28061f4032270785e627c21bb5
Author: Mark Wells <mark at freeside.biz>
Date: Mon Jan 26 18:29:32 2015 -0800
avoid adjusting bill date for suspended time if the package was credited on suspension, #31651
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 8a41791..de9aa08 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -1649,19 +1649,41 @@ sub unsuspend {
my $conf = new FS::Conf;
- $hash{'bill'} = ( $hash{'bill'} || $hash{'setup'} ) + $inactive
- if $inactive > 0
+ # increment next bill date if certain conditions are met:
+ # - it was due to be billed at some point
+ # - either the global or local config says to do this
+ my $adjust_bill = 0;
+ if (
+ $inactive > 0
&& ( $hash{'bill'} || $hash{'setup'} )
&& ( $opt{'adjust_next_bill'}
|| $conf->exists('unsuspend-always_adjust_next_bill_date')
|| $self->part_pkg->option('unsuspend_adjust_bill', 1)
)
- && ! $self->option('suspend_bill',1)
- && ( ! $self->part_pkg->option('suspend_bill',1)
- || $self->option('no_suspend_bill',1)
- )
- && $hash{'order_date'} != $hash{'susp'}
- ;
+ ) {
+ $adjust_bill = 1;
+ }
+
+ # but not if:
+ # - the package billed during suspension
+ # - or it was ordered on hold
+ # - or the customer was credited for the unused time
+
+ if ( $self->option('suspend_bill',1)
+ or ( $self->part_pkg->option('suspend_bill',1)
+ and ! $self->option('no_suspend_bill',1)
+ )
+ or $hash{'order_date'} == $hash{'susp'}
+ or $self->part_pkg->option('unused_credit_suspend')
+ or ( defined($reason) and $reason->unused_credit )
+ ) {
+ $adjust_bill = 0;
+ }
+
+ # then add the length of time suspended to the bill date
+ if ( $adjust_bill ) {
+ $hash{'bill'} = ( $hash{'bill'} || $hash{'setup'} ) + $inactive
+ }
$hash{'susp'} = '';
$hash{'adjourn'} = '' if $hash{'adjourn'} and $hash{'adjourn'} < time;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pkg.pm | 38 ++++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
More information about the freeside-commits
mailing list