summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin DeVuyst <justin@devuyst.com>2017-03-03 19:23:15 -0500
committerJustin DeVuyst <justin@devuyst.com>2017-03-03 19:23:15 -0500
commit70723170e55a4dbdcf69a227da79ec51e4f4c285 (patch)
tree5e6f12475627c38166e1ab5df6c52913ff37327b
parent62157b20f819936d8287f12689c3b5cb34efe7ae (diff)
Agent virtualize the attachment report. See RT#24899.
-rwxr-xr-xhttemplate/browse/cust_attachment.html23
1 files changed, 13 insertions, 10 deletions
diff --git a/httemplate/browse/cust_attachment.html b/httemplate/browse/cust_attachment.html
index f81ec1b6b..bc9597f24 100755
--- a/httemplate/browse/cust_attachment.html
+++ b/httemplate/browse/cust_attachment.html
@@ -11,10 +11,7 @@
<INPUT TYPE="hidden" NAME="orderby" VALUE="$orderby">
<INPUT TYPE="hidden" NAME="show_deleted" VALUE="$disabled">!
,
- 'query' => { 'table' => 'cust_attachment',
- 'hashref' => $hashref,
- 'order_by' => 'ORDER BY '.$orderby,
- },
+ 'query' => $query,
'count_query' => $count_query,
'header' => [ selflink('#',orderby => 'attachnum'),
selflink('Customer',orderby => 'custnum'),
@@ -90,14 +87,20 @@ else {
}
}
-my $hashref = $disabled ?
- { disabled => { op => '>', value => 0 } } :
- { disabled => '' };
+my $orderby = $cgi->param('orderby') || 'custnum';
-my $count_query = 'SELECT COUNT(*) FROM cust_attachment WHERE '. ($disabled ?
- 'disabled > 0' : 'disabled IS NULL');
+my $query = {
+ table => 'cust_attachment',
+ hashref => { disabled => $disabled ? { op => '>', value => 0 } : undef, },
+ order_by => "ORDER BY $orderby",
+ addl_from => 'JOIN cust_main USING (custnum)',
+ extra_sql => ' AND ' . $curuser->agentnums_sql,
+};
-my $orderby = $cgi->param('orderby') || 'custnum';
+my $count_query = 'SELECT COUNT(*) FROM cust_attachment'
+ . ' JOIN cust_main USING (custnum)'
+ . ' WHERE ' . $curuser->agentnums_sql
+ . ' AND disabled ' . ( $disabled ? '> 0' : 'IS NULL' );
my $sub_cust = sub {
my $c = qsearchs('cust_main', { custnum => shift->custnum } );