From fff0c848e4c9933934b8da41d23e45b204cac11b Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 27 Aug 2010 02:10:14 +0000 Subject: [PATCH] per-package option to adjust bill date on unsuspend, RT#8434 --- FS/FS/cust_pkg.pm | 14 ++++++++++---- FS/FS/part_pkg/flat.pm | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index f367fd34e..c27d4587d 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -1024,10 +1024,16 @@ sub unsuspend { my $conf = new FS::Conf; - $hash{'bill'} = ( $hash{'bill'} || $hash{'setup'} ) + $inactive - if ( $opt{'adjust_next_bill'} - || $conf->exists('unsuspend-always_adjust_next_bill_date') ) - && $inactive > 0 && ( $hash{'bill'} || $hash{'setup'} ); + 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) ) + ) { + + $hash{'bill'} = ( $hash{'bill'} || $hash{'setup'} ) + $inactive; + + } $hash{'susp'} = ''; $hash{'adjourn'} = '' if $hash{'adjourn'} < time; diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm index 537cdcf56..d539e8d1e 100644 --- a/FS/FS/part_pkg/flat.pm +++ b/FS/FS/part_pkg/flat.pm @@ -123,6 +123,11 @@ tie my %temporalities, 'Tie::IxHash', 'with the customer\'s other packages', 'type' => 'checkbox', }, + 'unsuspend_adjust_bill' => + { 'name' => 'Adjust next bill date forward when '. + 'unsuspending', + 'type' => 'checkbox', + }, %usage_fields, %usage_recharge_fields, @@ -134,6 +139,7 @@ tie my %temporalities, 'Tie::IxHash', 'fieldorder' => [ qw( setup_fee recur_fee recur_temporality unused_credit expire_months start_1st sync_bill_date + unsuspend_adjust_bill ), @usage_fieldorder, @usage_recharge_fieldorder, qw( externalid ), -- 2.11.0