[freeside-commits] branch master updated. 701888cb344e68274df2f95494a5c48b0773d908

Mark Wells mark at 420.am
Fri Dec 6 14:42:08 PST 2013


The branch, master has been updated
       via  701888cb344e68274df2f95494a5c48b0773d908 (commit)
      from  ec02246ea0218838def2b12b0b987f71662d1761 (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 701888cb344e68274df2f95494a5c48b0773d908
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Dec 6 14:41:55 2013 -0800

    advanced customer report: search by package class, #25531

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index b143861..b52b359 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -949,6 +949,31 @@ sub search {
     }
   }
 
+  # pkg_classnum
+  if ( $params->{'pkg_classnum'} ) {
+    my @pkg_classnums = ref( $params->{'pkg_classnum'} ) ?
+                          @{ $params->{'pkg_classnum'} } :
+                             $params->{'pkg_classnum'};
+    @pkg_classnums = grep /^(\d+)$/, @pkg_classnums;
+
+    if ( @pkg_classnums ) {
+
+      my @pkg_where;
+      if ( $params->{'all_pkg_classnums'} ) {
+        push @pkg_where, "part_pkg.classnum = $_" foreach @pkg_classnums;
+      } else {
+        push @pkg_where,
+          'part_pkg.classnum IN('. join(',', @pkg_classnums).')';
+      }
+      foreach (@pkg_where) {
+        push @where, "EXISTS(".
+          "SELECT 1 FROM cust_pkg JOIN part_pkg USING (pkgpart) WHERE ".
+          "cust_pkg.custnum = cust_main.custnum AND ".
+          $_ . ' AND ' . FS::cust_pkg->active_sql .
+        ')';
+      }
+    }
+  }
 
   ##
   # setup queries, subs, etc. for the search
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 66a3a98..b97a4ef 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -47,6 +47,7 @@ my @scalars = qw (
   cancelled_pkgs
   cust_fields flattened_pkgs
   all_tags
+  all_pkg_classnums
 );
 
 for my $param ( @scalars ) {
@@ -55,7 +56,7 @@ for my $param ( @scalars ) {
 }
 
 #lists
-for my $param (qw( classnum refnum payby tagnum )) {
+for my $param (qw( classnum refnum payby tagnum pkg_classnum )) {
   $search_hash{$param} = [ $cgi->param($param) ];
 }
 
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index 1ceb48e..4309fbb 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -119,6 +119,23 @@
         </TD>
       </TR>
 
+      <TR>
+        <TD ALIGN="right">With package of class</TD>
+        <TD>
+            <& /elements/select-pkg_class.html,
+                          'field'       => 'pkg_classnum',
+                          'multiple'    => 1,
+            &>
+          <DIV STYLE="display:inline-block; vertical-align:baseline">
+            <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
+              Any of these
+            <BR>
+            <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
+              All of these
+          </DIV>
+        </TD>
+      </TR>
+
     <& /elements/tr-select-payby.html,
                   'payby_type'   => 'cust',
                   'multiple'     => 1,

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

Summary of changes:
 FS/FS/cust_main/Search.pm               |   25 +++++++++++++++++++++++++
 httemplate/search/cust_main.html        |    3 ++-
 httemplate/search/report_cust_main.html |   17 +++++++++++++++++
 3 files changed, 44 insertions(+), 1 deletions(-)




More information about the freeside-commits mailing list