diff options
author | ivan <ivan> | 2010-06-29 04:22:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-06-29 04:22:52 +0000 |
commit | a075f88c222ca92c12a635257568c5b2087c84b1 (patch) | |
tree | ae9b6d41ee06623dfa3b422f9f94d86d29dd7856 /FS | |
parent | 6bc5b13b1a7039c578b16fb9d958bda79a828948 (diff) |
Ordered status for the limbo between Prospect and Active, RT#8712
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_main.pm | 30 | ||||
-rw-r--r-- | FS/FS/cust_pkg.pm | 17 |
2 files changed, 35 insertions, 12 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 78739bbb4..c83ae95b7 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -7151,7 +7151,8 @@ sub status { shift->cust_status(@_); } sub cust_status { my $self = shift; - for my $status (qw( prospect active inactive suspended cancelled )) { + # prospect ordered active inactive suspended cancelled + for my $status ( FS::cust_main->statuses() ) { my $method = $status.'_sql'; my $numnum = ( my $sql = $self->$method() ) =~ s/cust_main\.custnum/?/g; my $sth = dbh->prepare("SELECT $sql") or die dbh->errstr; @@ -7185,6 +7186,7 @@ Returns a hex triplet color string for this customer's status. use vars qw(%statuscolor); tie %statuscolor, 'Tie::IxHash', 'prospect' => '7e0079', #'000000', #black? naw, purple + 'ordered' => '009999', #teal? cyan? 'active' => '00CC00', #green 'inactive' => '0000CC', #blue 'suspended' => 'FF9900', #yellow @@ -7295,9 +7297,20 @@ sub select_count_pkgs_sql { $select_count_pkgs; } -sub prospect_sql { " - 0 = ( $select_count_pkgs ) -"; } +sub prospect_sql { + " 0 = ( $select_count_pkgs ) "; +} + +=item ordered_sql + +Returns an SQL expression identifying ordered cust_main records (customers with +recurring packages not yet setup). + +=cut + +sub ordered_sql { + " 0 < ( $select_count_pkgs AND ". FS::cust_pkg->ordered_sql. " ) "; +} =item active_sql @@ -7306,10 +7319,9 @@ active recurring packages). =cut -sub active_sql { " - 0 < ( $select_count_pkgs AND ". FS::cust_pkg->active_sql. " - ) -"; } +sub active_sql { + " 0 < ( $select_count_pkgs AND ". FS::cust_pkg->active_sql. " ) "; +} =item inactive_sql @@ -7599,7 +7611,7 @@ sub search { # parse status ## - #prospect active inactive suspended cancelled + #prospect ordered active inactive suspended cancelled if ( grep { $params->{'status'} eq $_ } FS::cust_main->statuses() ) { my $method = $params->{'status'}. '_sql'; #push @where, $class->$method(); diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index b851ac718..fdd8ddb54 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -2,7 +2,7 @@ package FS::cust_pkg; use strict; use base qw( FS::otaker_Mixin FS::cust_main_Mixin FS::location_Mixin - FS::m2m_Common FS::option_Common FS::Record ); + FS::m2m_Common FS::option_Common ); use vars qw($disable_agentcheck $DEBUG $me); use Carp qw(cluck); use Scalar::Util qw( blessed ); @@ -2426,14 +2426,25 @@ sub onetime_sql { " where cust_pkg.pkgpart = part_pkg.pkgpart ) "; } +=item ordered_sql + +Returns an SQL expression identifying ordered packages (recurring packages not +yet billed). + +=cut + +sub ordered_sql { + $_[0]->recurring_sql. " AND ". $_[0]->not_yet_billed_sql; +} + =item active_sql Returns an SQL expression identifying active packages. =cut -sub active_sql { " - ". $_[0]->recurring_sql(). " +sub active_sql { + $_[0]->recurring_sql. " AND cust_pkg.setup IS NOT NULL AND cust_pkg.setup != 0 AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) AND ( cust_pkg.susp IS NULL OR cust_pkg.susp = 0 ) |