RT#15006: Bug? Cancelled customers shown in reports?
authorJonathan Prykop <jonathan@freeside.biz>
Tue, 28 Jun 2016 03:40:44 +0000 (22:40 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Tue, 28 Jun 2016 11:58:36 +0000 (06:58 -0500)
FS/FS/cust_main.pm
httemplate/search/cust_main.cgi

index 79e674d..1b8e033 100644 (file)
@@ -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
 
index a3a7aef..b6aa0fa 100755 (executable)
@@ -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