summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2012-02-18 04:32:28 +0000
committerivan <ivan>2012-02-18 04:32:28 +0000
commit054d386242314b406e6bb2c69f2a62524c1a381b (patch)
treec98c7d9cb3406187b9407e71e266dfc68dbb7180 /httemplate
parent156b1169a814021cfb5d546fb18218dedba1742d (diff)
fix per-user commission reports to filter packages they didn't order, RT#15634
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/search/part_pkg.html37
1 files changed, 21 insertions, 16 deletions
diff --git a/httemplate/search/part_pkg.html b/httemplate/search/part_pkg.html
index 8d06ebd02..8a4419857 100644
--- a/httemplate/search/part_pkg.html
+++ b/httemplate/search/part_pkg.html
@@ -1,18 +1,19 @@
<% include( 'elements/search.html',
- 'title' => $title,
- 'name' => $name,
- 'header' => \@header,
- 'query' => { 'select' => $select,
- 'table' => 'part_pkg',
- 'addl_from' => $addl_from,
- 'hashref' => {},
- 'extra_sql' => $extra_sql,
- 'order_by' => "ORDER BY $order_by",
- },
- 'count_query' => $count_query,
- 'fields' => \@fields,
- 'links' => \@links,
- 'align' => $align,
+ 'title' => $title,
+ 'name_singular' => $name,
+ 'header' => \@header,
+ 'query' => { 'select' => $select,
+ 'table' => 'part_pkg',
+ 'addl_from' => $addl_from,
+ 'hashref' => {},
+ 'extra_sql' => $extra_sql,
+ 'order_by' => "ORDER BY $order_by",
+ },
+ 'count_query' => $count_query,
+ 'fields' => \@fields,
+ 'links' => \@links,
+ 'align' => $align,
+ 'sort_fields' => [],
)
%>
<%init>
@@ -64,6 +65,8 @@ if (1) { #commission reports
$title = $access_user->name;
+ $match = 'cust_pkg.usernum = '. $access_user->usernum;
+
} else {
push @header, 'Employee';
@@ -187,7 +190,7 @@ if (1) { #commission reports
my $access_user = qsearchs('access_user', { 'usernum' => $part_pkg->get('usernum'), })
or die "unknown usernum";
- return 0 unless $access_user->user_custnum;
+ return $money_char.'0.00' unless $access_user->user_custnum;
push @arg, $access_user->user_custnum;
} elsif (0) { #agent commission reports
@@ -209,7 +212,9 @@ $extra_sql .= "GROUP BY $group_by" if $group_by;
my $order_by = join(', ', @order_by);
#XXX agent?
-my $count_query = "SELECT COUNT(*) FROM ( SELECT 1 FROM part_pkg $addl_from $extra_sql ) AS num";
+#my $count_query = "SELECT COUNT(*) FROM ( SELECT 1 FROM part_pkg $addl_from $extra_sql ) AS num";
+#mysql?
+my $count_query = "SELECT COUNT(*) FROM ( SELECT DISTINCT part_pkg.pkgpart FROM part_pkg $addl_from $extra_sql ) AS num";
warn $count_query;
</%init>