[freeside-commits] branch FREESIDE_4_BRANCH updated. aad13b25b39a26af80f4377a2daa21b2db2022b4

Mark Wells mark at 420.am
Fri Aug 26 15:44:18 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  aad13b25b39a26af80f4377a2daa21b2db2022b4 (commit)
      from  b879005b9c38f96f83838cb9e8583a24e1ce377b (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 aad13b25b39a26af80f4377a2daa21b2db2022b4
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Aug 26 15:44:02 2016 -0700

    agent-virtual contract end date report, #71964

diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html
index 1b93775..5bb772b 100644
--- a/httemplate/search/cust_pkg-date.html
+++ b/httemplate/search/cust_pkg-date.html
@@ -36,6 +36,8 @@ my @sort_fields = ( map '', @fields ); # should only ever sort by $col
 push @header, FS::UI::Web::cust_header($cust_fields);
 push @fields, \&FS::UI::Web::cust_fields;
 
+my $agentnums_sql = $curuser->agentnums_sql('table' => 'cust_main');
+
 my $query = {
   'table'     => 'cust_pkg',
   'addl_from' => FS::UI::Web::join_cust_main('cust_pkg', 'cust_pkg'),
@@ -43,11 +45,13 @@ my $query = {
     $col => { op => '!=', value => '' },
     'cancel' => '',
   },
-  'order_by' => "ORDER BY $col",
+  'extra_sql' => ' AND '.$agentnums_sql,
+  'order_by'  => "ORDER BY $col",
 };
 
 my $count_query =
-  "SELECT COUNT(*) FROM cust_pkg WHERE $col IS NOT NULL AND cancel IS NULL";
+  "SELECT COUNT(*) FROM cust_pkg JOIN cust_main USING (custnum) ".
+  "WHERE $col IS NOT NULL AND cancel IS NULL AND $agentnums_sql";
 
 my $pkg_link = sub {
   my $self = shift;

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

Summary of changes:
 httemplate/search/cust_pkg-date.html |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list