[freeside-commits] branch master updated. 859eaa6ff11225dd556c02003cff2a102f6d5605

Jonathan Prykop jonathan at 420.am
Mon Jun 27 21:36:33 PDT 2016


The branch, master has been updated
       via  859eaa6ff11225dd556c02003cff2a102f6d5605 (commit)
       via  735f73aec092f56df6289e0fe4f655d57c11f93f (commit)
      from  6fbdc0d20421de8e0d93eb9d332a0683efb994cc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 859eaa6ff11225dd556c02003cff2a102f6d5605
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Jun 27 23:35:41 2016 -0500

    RT#25387: cust_main-status_module does not change status in reporting

diff --git a/FS/FS/cust_main_Mixin.pm b/FS/FS/cust_main_Mixin.pm
index 9fc66e0..adf8c71 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

commit 735f73aec092f56df6289e0fe4f655d57c11f93f
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Jun 27 22:40:44 2016 -0500

    RT#15006: Bug? Cancelled customers shown in reports?

diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index ecd3070..3fb0a87 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 62231a1..da6c89d 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

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main.pm              |   13 ++++---------
 FS/FS/cust_main_Mixin.pm        |   16 +++-------------
 httemplate/search/cust_main.cgi |    2 +-
 3 files changed, 8 insertions(+), 23 deletions(-)




More information about the freeside-commits mailing list