projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
option to show both open and closed RADIUS sessions, #21483
[freeside.git]
/
FS
/
FS
/
part_export
/
sqlradius.pm
diff --git
a/FS/FS/part_export/sqlradius.pm
b/FS/FS/part_export/sqlradius.pm
index
18ee304
..
db66c39
100644
(file)
--- a/
FS/FS/part_export/sqlradius.pm
+++ b/
FS/FS/part_export/sqlradius.pm
@@
-597,7
+597,8
@@
New-style: pass a hashref with the following keys:
=item stoptime_end - Upper bound for AcctStopTime, as a UNIX timestamp
=item stoptime_end - Upper bound for AcctStopTime, as a UNIX timestamp
-=item open_sessions - Only show records with no AcctStopTime (typically used without stoptime_* options and with starttime_* options instead)
+=item session_status - 'closed' to only show records with AcctStopTime,
+'open' to only show records I<without> AcctStopTime, empty to show both.
=item starttime_start - Lower bound for AcctStartTime, as a UNIX timestamp
=item starttime_start - Lower bound for AcctStartTime, as a UNIX timestamp
@@
-727,20
+728,23
@@
sub usage_sessions {
push @where, " CalledStationID LIKE 'sip:$prefix\%'";
}
push @where, " CalledStationID LIKE 'sip:$prefix\%'";
}
- if ( $opt->{open_sessions} ) {
- push @where, 'AcctStopTime IS NULL';
- } else {
-
+ my $acctstoptime = '';
+ if ( $opt->{session_status} ne 'open' ) {
if ( $start ) {
if ( $start ) {
-
push @where,
"$str2time AcctStopTime ) >= ?";
+
$acctstoptime .=
"$str2time AcctStopTime ) >= ?";
push @param, $start;
push @param, $start;
+ $acctstoptime .= ' AND ' if $end;
}
if ( $end ) {
}
if ( $end ) {
-
push @where,
"$str2time AcctStopTime ) <= ?";
+
$acctstoptime .=
"$str2time AcctStopTime ) <= ?";
push @param, $end;
}
push @param, $end;
}
-
}
}
+ if ( $opt->{session_status} ne 'closed' ) {
+ $acctstoptime = "( $acctstoptime ) OR " if $acctstoptime;
+ $acctstoptime .= 'AcctStopTime IS NULL';
+ }
+ push @where, $acctstoptime;
if ( $opt->{starttime_start} ) {
push @where, "$str2time AcctStartTime ) >= ?";
if ( $opt->{starttime_start} ) {
push @where, "$str2time AcctStartTime ) >= ?";