diff options
author | Ivan Kohler <ivan@freeside.biz> | 2012-06-04 15:29:18 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2012-06-04 15:29:18 -0700 |
commit | 17b4664d50ba04809cb8b68fa0f3b6146b0c8ff3 (patch) | |
tree | 30c13e0648b51046e3eda9c8f77a615f9e254654 /FS | |
parent | 93786ae8b97b3b11b11eff8ee5fdf78b6b53f26f (diff) |
suspend and unsuspend whole customer action, RT#17841
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/AccessRight.pm | 2 | ||||
-rw-r--r-- | FS/FS/access_right.pm | 12 | ||||
-rw-r--r-- | FS/FS/cust_main/Packages.pm | 12 |
3 files changed, 22 insertions, 4 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index bcf3f64..4aa777b 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -111,6 +111,8 @@ tie my %rights, 'Tie::IxHash', 'Edit customer tags', 'Edit referring customer', 'View customer history', + 'Suspend customer', + 'Unsuspend customer', 'Cancel customer', 'Complimentary customer', #aka users-allow_comp 'Merge customer', diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm index 26a480b..52cae34 100644 --- a/FS/FS/access_right.pm +++ b/FS/FS/access_right.pm @@ -3,6 +3,7 @@ package FS::access_right; use strict; use vars qw( @ISA ); use FS::Record qw( qsearch qsearchs ); +use FS::upgrade_journal; @ISA = qw(FS::Record); @@ -183,9 +184,13 @@ sub _upgrade_data { # class method my @all_groups = qsearch('access_group', {}); my %onetime = ( - 'List customers' => 'List all customers', - 'List packages' => 'Summarize packages', - 'Post payment' => 'Backdate payment', + 'List customers' => 'List all customers', + 'List packages' => 'Summarize packages', + 'Post payment' => 'Backdate payment', + 'Cancel customer package immediately' => 'Un-cancel customer package', + 'Suspend customer package' => 'Suspend customer', + 'Unsuspend customer package' => 'Unsuspend customer', + 'List services' => [ 'Services: Accounts', 'Services: Domains', 'Services: Certificates', @@ -205,7 +210,6 @@ sub _upgrade_data { # class method 'Usage: Call Detail Records (CDRs)', 'Usage: Unrateable CDRs', ], - 'Cancel customer package immediately' => 'Un-cancel customer package', ); foreach my $old_acl ( keys %onetime ) { diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm index 887ac49..957043a 100644 --- a/FS/FS/cust_main/Packages.pm +++ b/FS/FS/cust_main/Packages.pm @@ -355,6 +355,7 @@ Returns all suspended packages (see L<FS::cust_pkg>) for this customer. sub suspended_pkgs { my $self = shift; + return $self->num_suspended_pkgs unless wantarray; grep { $_->susp } $self->ncancelled_pkgs; } @@ -381,6 +382,7 @@ this customer. sub unsuspended_pkgs { my $self = shift; + return $self->num_unsuspended_pkgs unless wantarray; grep { ! $_->susp } $self->ncancelled_pkgs; } @@ -442,6 +444,16 @@ sub num_ncancelled_pkgs { shift->num_pkgs("( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 )"); } +sub num_suspended_pkgs { + shift->num_pkgs(" ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) + AND cust_pkg.susp IS NOT NULL AND cust_pkg.susp != 0 "); +} + +sub num_unsuspended_pkgs { + shift->num_pkgs(" ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) + AND ( cust_pkg.susp IS NULL OR cust_pkg.susp = 0 ) "); +} + sub num_pkgs { my( $self ) = shift; my $sql = scalar(@_) ? shift : ''; |