[freeside-commits] branch FREESIDE_4_BRANCH updated. eaa69278d9c4680abb0f736c51790c54dbf29b57

Jonathan Prykop jonathan at 420.am
Tue Jun 28 04:56:15 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  eaa69278d9c4680abb0f736c51790c54dbf29b57 (commit)
       via  fc9879b7cb4b1f0b4fefe850e2901e3f9a74f63b (commit)
      from  2164bf38a61edc4fd84240214a41549847751e40 (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 eaa69278d9c4680abb0f736c51790c54dbf29b57
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 fc9879b7cb4b1f0b4fefe850e2901e3f9a74f63b
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 8e96b42..6c43747 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -4997,15 +4997,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