[freeside-commits] branch FREESIDE_3_BRANCH updated. 901729ec75ad9635d5a14c7688288c8985795d56

Ivan ivan at 420.am
Fri Aug 23 23:10:55 PDT 2013


The branch, FREESIDE_3_BRANCH has been updated
       via  901729ec75ad9635d5a14c7688288c8985795d56 (commit)
      from  bf64a7f6f008be6cd9f5b7eda28039b4ae331e44 (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 901729ec75ad9635d5a14c7688288c8985795d56
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Aug 23 23:10:54 2013 -0700

    continue sales person work: customer and package selection, commissions, reporting.  RT#23402

diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 590b706..b022985 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -579,7 +579,16 @@ sub search {
   }
 
   ##
-  # do the same for user
+  # parse sales person
+  ##
+
+  if ( $params->{'salesnum'} =~ /^(\d+)$/ ) {
+    push @where, ($1 > 0 ) ? "cust_main.salesnum = $1"
+                           : 'cust_main.salesnum IS NULL';
+  }
+
+  ##
+  # parse usernum
   ##
 
   if ( $params->{'usernum'} =~ /^(\d+)$/ and $1 ) {
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index a2084fb..6124ad4 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -4135,6 +4135,25 @@ sub search {
   }
 
   ##
+  # parse customer sales person
+  ##
+
+  if ( $params->{'cust_main_salesnum'} =~ /^(\d+)$/ ) {
+    push @where, ($1 > 0) ? "cust_main.salesnum = $1"
+                          : 'cust_main.salesnum IS NULL';
+  }
+
+
+  ##
+  # parse sales person
+  ##
+
+  if ( $params->{'salesnum'} =~ /^(\d+)$/ ) {
+    push @where, ($1 > 0) ? "cust_pkg.salesnum = $1"
+                          : 'cust_pkg.salesnum IS NULL';
+  }
+
+  ##
   # parse custnum
   ##
 
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 24348ff..66a3a98 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -41,7 +41,7 @@ my %search_hash = ();
 
 #scalars
 my @scalars = qw (
-  agentnum status address zip paydate_year paydate_month invoice_terms
+  agentnum salesnum status address zip paydate_year paydate_month invoice_terms
   no_censustract with_geocode with_email POST no_POST
   custbatch usernum
   cancelled_pkgs
@@ -51,7 +51,7 @@ my @scalars = qw (
 
 for my $param ( @scalars ) {
   $search_hash{$param} = scalar( $cgi->param($param) )
-    if $cgi->param($param);
+    if length($cgi->param($param));
 }
 
 #lists
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 1cb61bc..32b5a69 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -156,8 +156,11 @@ my %search_hash = ();
 $search_hash{'query'} = $cgi->keywords;
 
 #scalars
-for (qw( agentnum custnum magic status custom cust_fields pkgbatch )) {
-  $search_hash{$_} = $cgi->param($_) if $cgi->param($_);
+for (qw( agentnum cust_main_salesnum salesnum custnum magic status custom
+         cust_fields pkgbatch
+    )) 
+{
+  $search_hash{$_} = $cgi->param($_) if length($cgi->param($_));
 }
 
 #arrays
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index bac4346..ebff7fa 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -14,6 +14,13 @@
                   'disable_empty' => 0,
     &>
 
+    <& /elements/tr-select-sales.html,
+                  'curr_value'    => scalar($cgi->param('salesnum')),
+                  'pre_options'   => [ '' => 'all',
+                                       0  => '(none)', ],
+                  'disable_empty' => 1,
+    &>
+
     <& /elements/tr-select-cust_main-status.html,
                   'label' => emt('Status'),
     &>
diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html
index e47bbb1..6cf297c 100755
--- a/httemplate/search/report_cust_pkg.html
+++ b/httemplate/search/report_cust_pkg.html
@@ -18,8 +18,27 @@
                    'disable_empty' => 0,
                )
     %>
+
+    <& /elements/tr-select-sales.html,
+                  'label'         => 'Customer sales person',
+                  'element_name'  => 'cust_main_salesnum',
+                  'id'            => 'cust_main_salesnum',
+                  'curr_value'    => scalar($cgi->param('cust_main_salesnum')),
+                  'pre_options'   => [ '' => 'all',
+                                       0  => '(none)', ],
+                  'disable_empty' => 1,
+    &>
+
 % }
 
+    <& /elements/tr-select-sales.html,
+                  'label'         => 'Package sales person',
+                  'curr_value'    => scalar($cgi->param('salesnum')),
+                  'pre_options'   => [ '' => 'all',
+                                        0  => '(none)', ],
+                  'disable_empty' => 1,
+    &>
+
     <% include( '/elements/tr-select-cust_pkg-status.html',
                   'onchange' => 'status_changed(this);',
               )

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

Summary of changes:
 FS/FS/cust_main/Search.pm               |   11 ++++++++++-
 FS/FS/cust_pkg.pm                       |   19 +++++++++++++++++++
 httemplate/search/cust_main.html        |    4 ++--
 httemplate/search/cust_pkg.cgi          |    7 +++++--
 httemplate/search/report_cust_main.html |    7 +++++++
 httemplate/search/report_cust_pkg.html  |   19 +++++++++++++++++++
 6 files changed, 62 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list