[freeside-commits] branch FREESIDE_4_BRANCH updated. f27699473b63c43706a6da94de6ebf8e901e2882

Ivan ivan at 420.am
Wed Nov 16 17:11:43 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  f27699473b63c43706a6da94de6ebf8e901e2882 (commit)
      from  dfb455957729b0a09e085853d3657b4b1d486cef (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 f27699473b63c43706a6da94de6ebf8e901e2882
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Nov 16 17:11:39 2016 -0800

    when searching locaitons, don't search historic locations by default, RT#73412

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index e021140..14dd4b4 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -695,6 +695,21 @@ sub search {
     push @where, FS::cust_main->$method();
   }
 
+  my $current = '';
+  unless ( $params->{location_history} ) {
+    $current = '
+      AND (    cust_location.locationnum IN ( cust_main.bill_locationnum,
+                                              cust_main.ship_locationnum
+                                            )
+            OR cust_location.locationnum IN (
+                 SELECT locationnum FROM cust_pkg
+                  WHERE cust_pkg.custnum = cust_main.custnum
+                    AND locationnum IS NOT NULL
+                    AND '. FS::cust_pkg->ncancelled_recurring_sql.'
+               )
+          )';
+  }
+
   ##
   # address
   ##
@@ -714,6 +729,7 @@ sub search {
         SELECT 1 FROM cust_location 
         WHERE cust_location.custnum = cust_main.custnum
           AND (".join(' OR ', at orwhere).")
+          $current
         )";
     }
   }
@@ -727,6 +743,7 @@ sub search {
       SELECT 1 FROM cust_location
       WHERE cust_location.custnum = cust_main.custnum
         AND cust_location.city = $city
+        $current
     )";
   }
 
@@ -739,6 +756,7 @@ sub search {
       SELECT 1 FROM cust_location
       WHERE cust_location.custnum = cust_main.custnum
         AND cust_location.county = $county
+        $current
     )";
   }
 
@@ -751,6 +769,7 @@ sub search {
       SELECT 1 FROM cust_location
       WHERE cust_location.custnum = cust_main.custnum
         AND cust_location.state = $state
+        $current
     )";
   }
 
@@ -763,6 +782,7 @@ sub search {
       SELECT 1 FROM cust_location
       WHERE cust_location.custnum = cust_main.custnum
         AND cust_location.zip LIKE $zip
+        $current
     )";
   }
 
@@ -775,6 +795,7 @@ sub search {
       SELECT 1 FROM cust_location
       WHERE cust_location.custnum = cust_main.custnum
         AND cust_location.country = '$country'
+        $current
     )";
   }
 
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 4de2faa..bcb5176 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -5079,6 +5079,17 @@ sub cancel_sql {
   "cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0";
 }
 
+=item ncancelled_recurring_sql
+
+Returns an SQL expression identifying un-cancelled, recurring packages.
+
+=cut
+
+sub ncancelled_recurring_sql {
+  $_[0]->recurring_sql().
+  " AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) ";
+}
+
 =item status_sql
 
 Returns an SQL expression to give the package status as a string.
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 672c201..1aa3390 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -41,7 +41,8 @@ my %search_hash = ();
 
 #scalars
 my @scalars = qw (
-  agentnum salesnum status address city county state zip country
+  agentnum salesnum status
+  address city county state zip country location_history
   invoice_terms
   no_censustract with_geocode with_email tax no_tax POST no_POST
   custbatch usernum
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index b6be023..69bbe85 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -197,6 +197,10 @@
       </TD>
     </TR>
 
+    <TR>
+      <TH ALIGN="right" VALIGN="center"><% mt('Search historical addresses') %></TH>
+      <TD><INPUT TYPE="checkbox" NAME="location_history" VALUE="1"></TD>
+
   </TABLE>
   <BR>
 

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

Summary of changes:
 FS/FS/cust_main/Search.pm               |   21 +++++++++++++++++++++
 FS/FS/cust_pkg.pm                       |   11 +++++++++++
 httemplate/search/cust_main.html        |    3 ++-
 httemplate/search/report_cust_main.html |    4 ++++
 4 files changed, 38 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list