[freeside-commits] branch master updated. ade06c71a2159e9079951c00662843455b01a5d8

Ivan ivan at 420.am
Fri Oct 21 12:08:13 PDT 2016


The branch, master has been updated
       via  ade06c71a2159e9079951c00662843455b01a5d8 (commit)
      from  3ac361c2b6b52209436b828be21ef8c416ba8ffc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ade06c71a2159e9079951c00662843455b01a5d8
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Oct 21 12:08:12 2016 -0700

    multi-select for agent on RADIUS usage report, RT#73050

diff --git a/httemplate/search/report_sqlradius_usage.html b/httemplate/search/report_sqlradius_usage.html
index 89b6084..38d52e5 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 11ec307..6b1806e 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(',', at 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

-----------------------------------------------------------------------

Summary of changes:
 httemplate/search/report_sqlradius_usage.html |    4 +++-
 httemplate/search/sqlradius_usage.html        |   26 ++++++++++++++++++-------
 2 files changed, 22 insertions(+), 8 deletions(-)




More information about the freeside-commits mailing list