From a3d005eab682ad0ff9bbb75d6794bd0279f123da Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Mon, 27 Jun 2016 22:40:44 -0500 Subject: [PATCH] RT#15006: Bug? Cancelled customers shown in reports? --- FS/FS/cust_main.pm | 13 ++++--------- httemplate/search/cust_main.cgi | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 79e674d56..1b8e0330a 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -4972,15 +4972,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 a3a7aef6b..b6aa0fa6d 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -503,7 +503,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 -- 2.11.0