[freeside-commits] freeside/FS/FS cust_main.pm, 1.515, 1.516 cust_pkg.pm, 1.163, 1.164
Ivan,,,
ivan at wavetail.420.am
Mon Jun 28 21:22:54 PDT 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv27425
Modified Files:
cust_main.pm cust_pkg.pm
Log Message:
Ordered status for the limbo between Prospect and Active, RT#8712
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.515
retrieving revision 1.516
diff -u -w -d -r1.515 -r1.516
--- cust_main.pm 19 Jun 2010 20:58:06 -0000 1.515
+++ cust_main.pm 29 Jun 2010 04:22:52 -0000 1.516
@@ -7151,7 +7151,8 @@
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 @@
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 @@
$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 @@
=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 @@
# 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();
Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -w -d -r1.163 -r1.164
--- cust_pkg.pm 22 May 2010 19:57:53 -0000 1.163
+++ cust_pkg.pm 29 Jun 2010 04:22:52 -0000 1.164
@@ -2,7 +2,7 @@
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 @@
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 )
More information about the freeside-commits
mailing list