From: Jonathan Prykop Date: Tue, 28 Jun 2016 03:40:44 +0000 (-0500) Subject: RT#15006: Bug? Cancelled customers shown in reports? X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=735f73aec092f56df6289e0fe4f655d57c11f93f RT#15006: Bug? Cancelled customers shown in reports? --- 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/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