[freeside-commits] branch FREESIDE_2_3_BRANCH updated. b2bc0890549ea23dfb1673191e4bc7e14d8d7740

Ivan ivan at 420.am
Mon Feb 11 13:19:02 PST 2013


The branch, FREESIDE_2_3_BRANCH has been updated
       via  b2bc0890549ea23dfb1673191e4bc7e14d8d7740 (commit)
      from  1951a5f6de2a3a5b6964c0016455dc438cd1b53c (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 b2bc0890549ea23dfb1673191e4bc7e14d8d7740
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Feb 11 13:19:00 2013 -0800

    fix RADIUS open sessions report (modern mysql & Pg?), RT#14218

diff --git a/FS/FS/part_export/sqlradius.pm b/FS/FS/part_export/sqlradius.pm
index 979d4fb..61f73f1 100644
--- a/FS/FS/part_export/sqlradius.pm
+++ b/FS/FS/part_export/sqlradius.pm
@@ -726,17 +726,21 @@ sub usage_sessions {
     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';
+  } 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};
@@ -755,10 +759,14 @@ sub usage_sessions {
   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({}) } ];
 

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

Summary of changes:
 FS/FS/part_export/sqlradius.pm |   32 ++++++++++++++++++++------------
 1 files changed, 20 insertions(+), 12 deletions(-)




More information about the freeside-commits mailing list