summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-06-28 16:39:05 -0700
committerMark Wells <mark@freeside.biz>2016-06-28 16:39:05 -0700
commitc663e377fd2c5089e7364b1144248edbaab76fe4 (patch)
tree4708d4a9e20d7f2aab187782083b7961b9950a8d
parent1c6bfeb43ab4a75417bb0cb69b22b77d034ec799 (diff)
parent859eaa6ff11225dd556c02003cff2a102f6d5605 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
-rw-r--r--FS/FS/cust_main.pm13
-rw-r--r--FS/FS/cust_main_Mixin.pm16
-rwxr-xr-xhttemplate/search/cust_main.cgi2
3 files changed, 8 insertions, 23 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index ecd30702f..3fb0a87fb 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4769,15 +4769,10 @@ Returns an SQL expression identifying un-cancelled cust_main records.
=cut
sub uncancelled_sql { uncancel_sql(@_); }
-sub uncancel_sql { "
- ( 0 < ( $select_count_pkgs
- AND ( cust_pkg.cancel IS NULL
- OR cust_pkg.cancel = 0
- )
- )
- OR 0 = ( $select_count_pkgs )
- )
-"; }
+sub uncancel_sql {
+ my $self = shift;
+ "( NOT (".$self->cancelled_sql.") )"; #sensitive to cust_main-status_module
+}
=item balance_sql
diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm
index 9fc66e059..adf8c7194 100644
--- a/FS/FS/cust_main_Mixin.pm
+++ b/FS/FS/cust_main_Mixin.pm
@@ -210,19 +210,9 @@ a customer.
sub cust_status {
my $self = shift;
return $self->cust_unlinked_msg unless $self->cust_linked;
-
- #FS::cust_main::status($self)
- #false laziness w/actual cust_main::status
- # (make sure FS::cust_main methods are called)
- for my $status (qw( prospect active inactive suspended cancelled )) {
- my $method = $status.'_sql';
- my $sql = FS::cust_main->$method();;
- my $numnum = ( $sql =~ s/cust_main\.custnum/?/g );
- my $sth = dbh->prepare("SELECT $sql") or die dbh->errstr;
- $sth->execute( ($self->custnum) x $numnum )
- or die "Error executing 'SELECT $sql': ". $sth->errstr;
- return $status if $sth->fetchrow_arrayref->[0];
- }
+ my $cust_main = $self->cust_main;
+ return $self->cust_unlinked_msg unless $cust_main;
+ return $cust_main->cust_status;
}
=item ucfirst_cust_status
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi
index 62231a120..da6c89d44 100755
--- a/httemplate/search/cust_main.cgi
+++ b/httemplate/search/cust_main.cgi
@@ -501,7 +501,7 @@ if ( $cgi->param('browse')
);
}
- @cust_main = grep { $_->num_ncancelled_pkgs || ! $_->num_pkgs } @cust_main
+ @cust_main = grep { $_->status ne 'cancelled' } @cust_main
if ! $cgi->param('cancelled')
&& (
$cgi->param('showcancelledcustomers') eq '0' #see if it was set by me