diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-09-16 23:41:47 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-09-16 23:41:47 -0700 |
commit | 03728b5a1f7e30faebc170389c4d91481ade685e (patch) | |
tree | 091ce73c113ed9adbe378e26847c1744b789772d /FS | |
parent | ee17093f5b41c1544d00a2670d26794aee33077a (diff) | |
parent | 7a486dea647f735a9a1d0381443218ad6affe6e1 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/Record.pm | 4 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 19 | ||||
-rw-r--r-- | FS/FS/cust_main/Billing.pm | 16 | ||||
-rw-r--r-- | FS/FS/part_pkg.pm | 27 |
5 files changed, 39 insertions, 34 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 616a06c90..e56cf3b2d 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4046,13 +4046,6 @@ and customer address. Include units.', }, { - 'key' => 'disable_setup_suspended_pkgs', - 'section' => 'billing', - 'description' => 'Disables charging of setup fees for suspended packages.', - 'type' => 'checkbox', - }, - - { 'key' => 'password-generated-allcaps', 'section' => 'password', 'description' => 'Causes passwords automatically generated to consist entirely of capital letters', diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index c53c9ae3c..4915b96ef 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -3322,7 +3322,7 @@ sub scalar_sql { defined($scalar) ? $scalar : ''; } -=item count [ WHERE ] +=item count [ WHERE [, PLACEHOLDER ...] ] Convenience method for the common case of "SELECT COUNT(*) FROM table", with optional WHERE. Must be called as method on a class with an @@ -3335,7 +3335,7 @@ sub count { my $table = $self->table or die 'count called on object of class '.ref($self); my $sql = "SELECT COUNT(*) FROM $table"; $sql .= " WHERE $where" if $where; - $self->scalar_sql($sql); + $self->scalar_sql($sql, @_); } =back diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 9b893eacd..84426b4ac 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2171,14 +2171,27 @@ sub cust_payby { =item unsuspend Unsuspends all unflagged suspended packages (see L</unflagged_suspended_pkgs> -and L<FS::cust_pkg>) for this customer. Always returns a list: an empty list -on success or a list of errors. +and L<FS::cust_pkg>) for this customer, except those on hold. + +Returns a list: an empty list on success or a list of errors. =cut sub unsuspend { my $self = shift; - grep { $_->unsuspend } $self->suspended_pkgs; + grep { ($_->get('setup')) && $_->unsuspend } $self->suspended_pkgs; +} + +=item release_hold + +Unsuspends all suspended packages in the on-hold state (those without setup +dates) for this customer. + +=cut + +sub release_hold { + my $self = shift; + grep { (!$_->setup) && $_->unsuspend } $self->suspended_pkgs; } =item suspend diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index d55cb2f37..29f7e8e54 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -1090,6 +1090,16 @@ sub _make_lines { my %setup_param = ( 'discounts' => \@setup_discounts ); my $setup_billed_currency = ''; my $setup_billed_amount = 0; + # Conditions for setting setup date and charging the setup fee: + # - this is not a recurring-only billing run + # - and the package is not currently being canceled + # - and, unless we're specifically told otherwise via 'resetup': + # - it doesn't already HAVE a setup date + # - or a start date in the future + # - and it's not suspended + # + # The last condition used to check the "disable_setup_suspended" option but + # that's obsolete. We now never set the setup date on a suspended package. if ( ! $options{recurring_only} and ! $options{cancel} and ( $options{'resetup'} @@ -1097,11 +1107,7 @@ sub _make_lines { && ( ! $cust_pkg->start_date || $cust_pkg->start_date <= $cmp_time ) - && ( ! $conf->exists('disable_setup_suspended_pkgs') - || ( $conf->exists('disable_setup_suspended_pkgs') && - ! $cust_pkg->getfield('susp') - ) - ) + && ( ! $cust_pkg->getfield('susp') ) ) ) ) diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 005d69d05..e4927a389 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -1818,23 +1818,16 @@ sub _upgrade_data { # class method die $error if $error; } - foreach my $optionname( qw( - recur_hourly_% - recur_input_% - recur_output_% - recur_total_% - ) ){ - foreach my $opt (qsearch('part_pkg_option', - { 'optionname' => { op => 'LIKE', - value => $optionname, - }, - pkgpart => $pkgpart, - })){ - $opt->optionvalue($opt->optionvalue * 1024); - - my $error = $opt->replace; - die $error if $error; - } + foreach my $opt (qsearch('part_pkg_option', + { 'optionname' => { op => 'LIKE', + value => 'recur_%_charge', + }, + pkgpart => $pkgpart, + })){ + $opt->optionvalue($opt->optionvalue * 1024); + + my $error = $opt->replace; + die $error if $error; } } |