summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-10-21 12:08:15 -0700
committerIvan Kohler <ivan@freeside.biz>2016-10-21 12:08:15 -0700
commitc9509e72848c1c1c61365390fe9caf39e0577cf4 (patch)
treecd597a9150bd5194cd091a432e2a83722a5c3925
parentf4b27b54c3d5664045996dfeb3ff1c4ed474f8c0 (diff)
multi-select for agent on RADIUS usage report, RT#73050
-rw-r--r--httemplate/search/report_sqlradius_usage.html4
-rw-r--r--httemplate/search/sqlradius_usage.html26
2 files changed, 22 insertions, 8 deletions
diff --git a/httemplate/search/report_sqlradius_usage.html b/httemplate/search/report_sqlradius_usage.html
index 89b60847b..38d52e531 100644
--- a/httemplate/search/report_sqlradius_usage.html
+++ b/httemplate/search/report_sqlradius_usage.html
@@ -6,7 +6,9 @@
<TABLE BGCOLOR="#cccccc" CELLSPACING=0>
<& /elements/tr-select-agent.html,
- 'empty_label' => 'all',
+ 'multiple' => 1,
+ 'disable_empty' => 1,
+ #'empty_label' => 'all',
&>
%#more future-proof to actually ask all exports if they ->can('usage_sessions')
diff --git a/httemplate/search/sqlradius_usage.html b/httemplate/search/sqlradius_usage.html
index 73ed57cfb..e5b1fa7a0 100644
--- a/httemplate/search/sqlradius_usage.html
+++ b/httemplate/search/sqlradius_usage.html
@@ -64,20 +64,32 @@ my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied" unless $curuser->access_right('List services');
my $title = 'Data Usage Report - ';
-my $agentnum;
-my @include_agents;
+my $agentnum = '';
+my @include_agents = ();
-if ( $opt{'agentnum'} ) {
+if ( $opt{'agentnum'} =~ /^(\d+)$/ ) {
$agentnum = $opt{'agentnum'};
-} elsif ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
- $agentnum = $1;
+} else {
+
+ my @agentnums = grep /^(\d+)$/, $cgi->param('agentnum');
+
+ if ( ! @agentnums ) {
+ @include_agents = qsearch('agent', {});
+ } elsif ( scalar(@agentnums) == 1 ) {
+ $agentnum = $agentnums[0];
+ } else {
+ @include_agents = qsearch({ 'table' => 'agent',
+ 'extra_sql' => 'WHERE agentnum IN ('.
+ join(',',@agentnums). ') '.
+ ' AND '. $curuser->agentnums_sql,
+ });
+ }
+
}
if ( $agentnum ) {
my $agent = FS::agent->by_key($agentnum);
$title = $agent->agent." $title";
-} else {
- @include_agents = qsearch('agent', {});
}
# usage query params