summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-03-04 18:33:52 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-03-09 21:27:57 -0500
commit64489396dd98a369aa2c38d3802400c2c508f136 (patch)
treeaf1cc7073d003089997aa6dd88a678ba352807a2 /httemplate
parenta4b5a3e0da1e747e5937be1cc69841158743f8a9 (diff)
RT#22952: Employee drop down list in reports shows employee users for all agents
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/select-user.html13
-rw-r--r--httemplate/search/report_cust_bill_pkg_discount.html10
-rw-r--r--httemplate/search/report_cust_credit.html10
-rw-r--r--httemplate/search/report_cust_credit_bill_pkg.html11
-rw-r--r--httemplate/search/report_cust_credit_void.html10
-rw-r--r--httemplate/search/report_cust_pkg_discount.html10
6 files changed, 11 insertions, 53 deletions
diff --git a/httemplate/elements/select-user.html b/httemplate/elements/select-user.html
index ec2341be6..e77788f61 100644
--- a/httemplate/elements/select-user.html
+++ b/httemplate/elements/select-user.html
@@ -17,17 +17,6 @@
my %opt = @_;
-unless ( $opt{'access_user'} ) {
-
- my $sth = dbh->prepare("
- SELECT usernum, username FROM access_user
- WHERE disabled = '' or disabled IS NULL
- ") or die dbh->errstr;
- $sth->execute or die $sth->errstr;
- while ( my $row = $sth->fetchrow_arrayref ) {
- $opt{'access_user'}->{$row->[0]} = $row->[1];
- }
-
-}
+$opt{'access_user'} ||= $FS::CurrentUser::CurrentUser->access_users_hashref();
</%init>
diff --git a/httemplate/search/report_cust_bill_pkg_discount.html b/httemplate/search/report_cust_bill_pkg_discount.html
index 77affd19d..10ccba912 100644
--- a/httemplate/search/report_cust_bill_pkg_discount.html
+++ b/httemplate/search/report_cust_bill_pkg_discount.html
@@ -13,7 +13,7 @@
<& /elements/tr-select-user.html,
'label' => 'Discounts by employee: ',
- 'access_user' => \%access_user,
+ 'access_user' => $access_user,
&>
<& /elements/tr-select-agent.html,
@@ -44,12 +44,6 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT usernum FROM cust_pkg_discount")
- or die dbh->errstr;
-$sth->execute or die $sth->errstr;
-my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
-my %access_user =
- map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
- @usernum;
+my $access_user = $FS::CurrentUser::CurrentUser->access_users_hashref('table' => 'cust_pkg_discount');
</%init>
diff --git a/httemplate/search/report_cust_credit.html b/httemplate/search/report_cust_credit.html
index dbab66ae5..0d7a2770a 100644
--- a/httemplate/search/report_cust_credit.html
+++ b/httemplate/search/report_cust_credit.html
@@ -8,7 +8,7 @@
<& /elements/tr-select-user.html,
'label' => emt('Credits by employee: '),
- 'access_user' => \%access_user,
+ 'access_user' => $access_user,
&>
<& /elements/tr-select-agent.html,
@@ -38,13 +38,7 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT usernum FROM cust_credit")
- or die dbh->errstr;
-$sth->execute or die $sth->errstr;
-my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
-my %access_user =
- map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
- @usernum;
+my $access_user = $FS::CurrentUser::CurrentUser->access_users_hashref('table' => 'cust_credit');
my $unapplied = $cgi->param('unapplied') ? 1 : 0;
diff --git a/httemplate/search/report_cust_credit_bill_pkg.html b/httemplate/search/report_cust_credit_bill_pkg.html
index 175403219..2849c8d3e 100644
--- a/httemplate/search/report_cust_credit_bill_pkg.html
+++ b/httemplate/search/report_cust_credit_bill_pkg.html
@@ -7,7 +7,7 @@
<& /elements/tr-select-user.html,
'label' => emt('Employee: '),
- 'access_user' => \%access_user,
+ 'access_user' => $access_user,
&>
<& /elements/tr-select-agent.html,
@@ -89,14 +89,7 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-#false laziness w/report_cust_credit.html
-my $sth = dbh->prepare("SELECT DISTINCT usernum FROM cust_credit")
- or die dbh->errstr;
-$sth->execute or die $sth->errstr;
-my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
-my %access_user =
- map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
- @usernum;
+my $access_user = $FS::CurrentUser::CurrentUser->access_users_hashref('table' => 'cust_credit');
my $conf = new FS::Conf;
diff --git a/httemplate/search/report_cust_credit_void.html b/httemplate/search/report_cust_credit_void.html
index e96708090..16a9e42d6 100644
--- a/httemplate/search/report_cust_credit_void.html
+++ b/httemplate/search/report_cust_credit_void.html
@@ -7,7 +7,7 @@
<& /elements/tr-select-user.html,
'label' => emt('Credit voids by employee: '),
- 'access_user' => \%access_user,
+ 'access_user' => $access_user,
&>
<& /elements/tr-select-agent.html,
@@ -37,13 +37,7 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT usernum FROM cust_credit_void")
- or die dbh->errstr;
-$sth->execute or die $sth->errstr;
-my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
-my %access_user =
- map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
- @usernum;
+my $access_user = $FS::CurrentUser::CurrentUser->access_users_hashref('table' => 'cust_credit_void');
my $title = 'Voided credit report';
diff --git a/httemplate/search/report_cust_pkg_discount.html b/httemplate/search/report_cust_pkg_discount.html
index 7f0e55fed..2b9052f5b 100644
--- a/httemplate/search/report_cust_pkg_discount.html
+++ b/httemplate/search/report_cust_pkg_discount.html
@@ -23,7 +23,7 @@
<& /elements/tr-select-user.html,
'label' => 'Discounts by employee: ',
- 'access_user' => \%access_user,
+ 'access_user' => $access_user,
&>
<& /elements/tr-select-agent.html,
@@ -45,12 +45,6 @@
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
-my $sth = dbh->prepare("SELECT DISTINCT usernum FROM cust_pkg_discount")
- or die dbh->errstr;
-$sth->execute or die $sth->errstr;
-my @usernum = map $_->[0], @{$sth->fetchall_arrayref};
-my %access_user =
- map { $_ => qsearchs('access_user',{'usernum'=>$_})->username }
- @usernum;
+my $access_user = $FS::CurrentUser::CurrentUser->access_users_hashref('table' => 'cust_pkg_discount');
</%init>