projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fb33bc6
)
fix RADIUS open sessions report (modern mysql & Pg?), RT#14218
author
Ivan Kohler
<ivan@freeside.biz>
Mon, 11 Feb 2013 21:18:59 +0000
(13:18 -0800)
committer
Ivan Kohler
<ivan@freeside.biz>
Mon, 11 Feb 2013 21:18:59 +0000
(13:18 -0800)
FS/FS/part_export/sqlradius.pm
patch
|
blob
|
history
diff --git
a/FS/FS/part_export/sqlradius.pm
b/FS/FS/part_export/sqlradius.pm
index
58cc5be
..
18ee304
100644
(file)
--- a/
FS/FS/part_export/sqlradius.pm
+++ b/
FS/FS/part_export/sqlradius.pm
@@
-727,17
+727,21
@@
sub usage_sessions {
push @where, " CalledStationID LIKE 'sip:$prefix\%'";
}
push @where, " CalledStationID LIKE 'sip:$prefix\%'";
}
- if ( $start ) {
- push @where, "$str2time AcctStopTime ) >= ?";
- push @param, $start;
- }
- if ( $end ) {
- push @where, "$str2time AcctStopTime ) <= ?";
- push @param, $end;
- }
if ( $opt->{open_sessions} ) {
push @where, 'AcctStopTime IS NULL';
if ( $opt->{open_sessions} ) {
push @where, 'AcctStopTime IS NULL';
+ } else {
+
+ if ( $start ) {
+ push @where, "$str2time AcctStopTime ) >= ?";
+ push @param, $start;
+ }
+ if ( $end ) {
+ push @where, "$str2time AcctStopTime ) <= ?";
+ push @param, $end;
+ }
+
}
}
+
if ( $opt->{starttime_start} ) {
push @where, "$str2time AcctStartTime ) >= ?";
push @param, $opt->{starttime_start};
if ( $opt->{starttime_start} ) {
push @where, "$str2time AcctStartTime ) >= ?";
push @param, $opt->{starttime_start};
@@
-756,10
+760,14
@@
sub usage_sessions {
my $orderby = 'ORDER BY AcctStartTime DESC';
$orderby = '' if $summarize;
my $orderby = 'ORDER BY AcctStartTime DESC';
$orderby = '' if $summarize;
- my $sth = $dbh->prepare('SELECT '. join(', ', @fields).
- " FROM radacct $where $groupby $orderby
- ") or die $dbh->errstr;
- $sth->execute(@param) or die $sth->errstr;
+ my $sql = 'SELECT '. join(', ', @fields).
+ " FROM radacct $where $groupby $orderby";
+ if ( $DEBUG ) {
+ warn $sql;
+ warn join(',', @param);
+ }
+ my $sth = $dbh->prepare($sql) or die $dbh->errstr;
+ $sth->execute(@param) or die $sth->errstr;
[ map { { %$_ } } @{ $sth->fetchall_arrayref({}) } ];
[ map { { %$_ } } @{ $sth->fetchall_arrayref({}) } ];