diff options
author | ivan <ivan> | 2006-07-13 03:54:07 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-07-13 03:54:07 +0000 |
commit | 779ca0263837bebf7f0ab6f45cb8381706049658 (patch) | |
tree | 3b767f57e71582f98ae36ee80a6f5b2bb3895ce3 /httemplate | |
parent | e5742a8ccfca16427631a45fc8895d6fc1a493dd (diff) |
fix multiple-agent virtualization properly for these reports
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/search/cust_credit.html | 7 | ||||
-rwxr-xr-x | httemplate/search/cust_pay.cgi | 16 | ||||
-rwxr-xr-x | httemplate/search/report_receivables.cgi | 3 |
3 files changed, 16 insertions, 10 deletions
diff --git a/httemplate/search/cust_credit.html b/httemplate/search/cust_credit.html index 279d682..eb78db5 100755 --- a/httemplate/search/cust_credit.html +++ b/httemplate/search/cust_credit.html @@ -36,9 +36,10 @@ push @search, " _date < $1 "; } - my $where = scalar(@search) - ? 'WHERE '. join(' AND ', @search) - : ''; + #here is the agent virtualization + push @search, $FS::CurrentUser::CurrentUser->agentnums_sql; + + my $where = 'WHERE '. join(' AND ', @search); my $count_query = 'SELECT COUNT(*), SUM(amount) '. 'FROM cust_credit LEFT JOIN cust_main USING ( custnum ) '. diff --git a/httemplate/search/cust_pay.cgi b/httemplate/search/cust_pay.cgi index 99ffc3d..0247b0b 100755 --- a/httemplate/search/cust_pay.cgi +++ b/httemplate/search/cust_pay.cgi @@ -96,10 +96,10 @@ die "unknown search magic: ". $cgi->param('magic'); } - my $search = ''; - if ( @search ) { - $search = ' WHERE '. join(' AND ', @search); - } + #here is the agent virtualization + push @search, $FS::CurrentUser::CurrentUser->agentnums_sql; + + my $search = ' WHERE '. join(' AND ', @search); $count_query = "SELECT COUNT(*), SUM(paid) ". "FROM cust_pay LEFT JOIN cust_main USING ( custnum )". @@ -125,14 +125,16 @@ $cgi->param('payby') =~ /^(\w+)$/ or die "illegal payby"; my $payby = $1; - $count_query = "SELECT COUNT(*), SUM(paid) FROM cust_pay ". - "WHERE payinfo = '$payinfo' AND payby = '$payby'"; + $count_query = "SELECT COUNT(*), SUM(paid) FROM cust_pay". + " WHERE payinfo = '$payinfo' AND payby = '$payby'". + " AND ". $FS::CurrentUser::CurrentUser->agentnums_sql; $sql_query = { 'table' => 'cust_pay', 'hashref' => { 'payinfo' => $payinfo, 'payby' => $payby }, - 'extra_sql' => "ORDER BY _date", + 'extra_sql' => $FS::CurrentUser::CurrentUser->agentnums_sql. + " ORDER BY _date", }; } diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index ac94e1a..c1a239f 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -92,6 +92,9 @@ END $where .= " AND agentnum = '$agentnum' "; } + #here is the agent virtualization + $where .= ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql; + my $count_sql = "select count(*) from cust_main $where"; my $sql_query = { |