diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2012-07-08 22:43:19 -0700 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2012-07-08 22:43:19 -0700 |
| commit | 7c9d0e84f7cdf6cd6af3dea9399f2ad30015875f (patch) | |
| tree | 3efe38bead6f579c0394498dbcf60d84bf09c42a /FS | |
| parent | b3d471fc5a646dc0197dd177873899e5b240ea33 (diff) | |
per-package flags to override package def level suspend_bill flag, RT#18376
Diffstat (limited to 'FS')
| -rw-r--r-- | FS/FS/cust_main/Billing.pm | 5 | ||||
| -rw-r--r-- | FS/FS/cust_main/Packages.pm | 6 | ||||
| -rw-r--r-- | FS/FS/cust_pkg.pm | 7 |
3 files changed, 15 insertions, 3 deletions
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index e9cac8db9..ef51fdb1f 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -953,7 +953,10 @@ sub _make_lines { my @recur_discounts = (); my $sdate; if ( ! $cust_pkg->start_date - and ( ! $cust_pkg->susp || $part_pkg->option('suspend_bill', 1) ) + and ( ! $cust_pkg->susp || $cust_pkg->option('suspend_bill',1) + || ( $part_pkg->option('suspend_bill', 1) ) + && ! $cust_pkg->option('no_suspend_bill',1) + ) and ( $part_pkg->freq ne '0' && ( $cust_pkg->bill || 0 ) <= day_end($time) ) || ( $part_pkg->plan eq 'voip_cdr' diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm index 51457536a..2aec35c49 100644 --- a/FS/FS/cust_main/Packages.pm +++ b/FS/FS/cust_main/Packages.pm @@ -408,7 +408,11 @@ sub billing_pkgs { my $self = shift; grep { my $part_pkg = $_->part_pkg; $part_pkg->freq ne '' && $part_pkg->freq ne '0' - && ( ! $_->susp || $part_pkg->option('suspend_bill', 1) ); + && ( ! $_->susp || $_->option('suspend_bill',1) + || ( $part_pkg->option('suspend_bill', 1) + && ! $_->option('no_suspend_bill',1) + ) + ); } $self->ncancelled_pkgs; } diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index d16881a69..1c79ed752 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1176,8 +1176,13 @@ sub suspend { $hash{'resume'} = $resume_date; } + $options{options} ||= {}; + my $new = new FS::cust_pkg ( \%hash ); - $error = $new->replace( $self, options => { $self->options } ); + $error = $new->replace( $self, options => { $self->options, + %{ $options{options} }, + } + ); if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; |
