fix error on open-ended RADIUS search with Pg, add options for open session search...
[freeside.git] / httemplate / search / sqlradius.cgi
index 24b17d3..29f3602 100644 (file)
   </TR>
 
 %   foreach my $session (
   </TR>
 
 %   foreach my $session (
-%       @{ $part_export->usage_sessions(
-%            $beginning, $ending, $cgi_svc_acct, $ip, $prefix, ) }
+%       @{ $part_export->usage_sessions( {
+%            'stoptime_start'  => $beginning,
+%            'stoptime_end'    => $ending,
+%            'open_sessions'   => $open_sessions,
+%            'starttime_start' => $starttime_beginning,
+%            'starttime_end'   => $starttime_ending,
+%            'svc_acct'        => $cgi_svc_acct,
+%            'ip'              => $ip,
+%            'prefix'          => $prefix, 
+%          } )
+%       }
 %   ) {
 %     if ( $bgcolor eq $bgcolor1 ) {
 %       $bgcolor = $bgcolor2;
 %   ) {
 %     if ( $bgcolor eq $bgcolor1 ) {
 %       $bgcolor = $bgcolor2;
@@ -88,14 +97,13 @@ die "access denied"
 ###
 
 #sort of false laziness w/cust_pay.cgi
 ###
 
 #sort of false laziness w/cust_pay.cgi
-my $beginning = '';
-my $ending = '';
-if ( $cgi->param('beginning')
-     && $cgi->param('beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+my( $beginning, $ending ) = ( '', '' );
+if ( $cgi->param('stoptime_beginning')
+     && $cgi->param('stoptime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
   $beginning = str2time($1);
 }
   $beginning = str2time($1);
 }
-if ( $cgi->param('ending')
-     && $cgi->param('ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+if ( $cgi->param('stoptime_ending')
+     && $cgi->param('stoptime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
   $ending = str2time($1); # + 86399;
 }
 if ( $cgi->param('begin') && $cgi->param('begin') =~ /^(\d+)$/ ) {
   $ending = str2time($1); # + 86399;
 }
 if ( $cgi->param('begin') && $cgi->param('begin') =~ /^(\d+)$/ ) {
@@ -105,6 +113,21 @@ if ( $cgi->param('end') && $cgi->param('end') =~ /^(\d+)$/ ) {
   $ending = $1;
 }
 
   $ending = $1;
 }
 
+my $open_sessions = '';
+if ( $cgi->param('open_sessions') =~ /^(\d*)$/ ) {
+  $open_sessions = $1;
+}
+
+my( $starttime_beginning, $starttime_ending ) = ( '', '' );
+if ( $cgi->param('starttime_beginning')
+     && $cgi->param('starttime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+  $starttime_beginning = str2time($1);
+}
+if ( $cgi->param('starttime_ending')
+     && $cgi->param('starttime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+  $starttime_ending = str2time($1); # + 86399;
+}
+
 my $cgi_svc_acct = '';
 if ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
   $cgi_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $1 } );
 my $cgi_svc_acct = '';
 if ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
   $cgi_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $1 } );