[freeside-commits] branch master updated. 23f2db6452f097640447b9b35dd106f408dbc20b

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


The branch, master has been updated
       via  23f2db6452f097640447b9b35dd106f408dbc20b (commit)
      from  5fa459e35a04b69cbdc6b5b938eabcbc1bac6c74 (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 23f2db6452f097640447b9b35dd106f408dbc20b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Aug 23 23:10:52 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 3e638a6..19ef1f3 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -4169,6 +4169,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