[freeside-commits] branch FREESIDE_3_BRANCH updated. 1eff559d376d03ceb8de01dbc9dee9bf83bc647f

Jonathan Prykop jonathan at 420.am
Tue Jun 28 05:02:56 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  1eff559d376d03ceb8de01dbc9dee9bf83bc647f (commit)
       via  a3d005eab682ad0ff9bbb75d6794bd0279f123da (commit)
      from  ba4c3441c41303528ad0a51efa23e916083bb3ee (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 1eff559d376d03ceb8de01dbc9dee9bf83bc647f
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 dee9aa8..6e9111e 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 a3d005eab682ad0ff9bbb75d6794bd0279f123da
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 79e674d..1b8e033 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 a3a7aef..b6aa0fa 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

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

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