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-04 18:33:52 -0600
commit7c7d54475dcdb041af4b42b13d3d4084627a8e9f (patch)
tree8a9410d39428681828d24e5ac87e1f396e4ca3c4 /httemplate
parent8dfb2c715ff2de2553bcf3744a2b4d742314a2cb (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_source_bill_pkg.html11
-rw-r--r--httemplate/search/report_cust_credit_void.html10
-rw-r--r--httemplate/search/report_cust_pkg_discount.html10
7 files changed, 13 insertions, 62 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 ad0f3f62e..1a54a122b 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,
@@ -80,14 +80,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_source_bill_pkg.html b/httemplate/search/report_cust_credit_source_bill_pkg.html
index b579b92cc..7bfacc4fa 100644
--- a/httemplate/search/report_cust_credit_source_bill_pkg.html
+++ b/httemplate/search/report_cust_credit_source_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,
@@ -58,14 +58,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>