X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fsearch%2Fcust_pkg-date.html;h=5bb772bf6d485284308e5e7bd7bfe264a88bef0a;hb=bcaab65d7ce645ea7fef8361fe57fbcde532b0ab;hp=1b93775467d7c41448a61d4e4c8cbacc08ab7840;hpb=8b37069f938208760656e740ebbf0e49c1ef1854;p=freeside.git diff --git a/httemplate/search/cust_pkg-date.html b/httemplate/search/cust_pkg-date.html index 1b9377546..5bb772bf6 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;