fix RADIUS report fallout from adding closed session option, RT#22169, RT#21483
authorIvan Kohler <ivan@freeside.biz>
Wed, 27 Mar 2013 02:00:27 +0000 (19:00 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 27 Mar 2013 02:00:27 +0000 (19:00 -0700)
FS/FS/part_export/sqlradius.pm

index db66c39..833dd9a 100644 (file)
@@ -741,8 +741,11 @@ sub usage_sessions {
     }
   }
   if ( $opt->{session_status} ne 'closed' ) {
-    $acctstoptime = "( $acctstoptime ) OR " if $acctstoptime;
-    $acctstoptime .= 'AcctStopTime IS NULL';
+    if ( $acctstoptime ) {
+      $acctstoptime = "( ( $acctstoptime ) OR AcctStopTime IS NULL )";
+    } else {
+      $acctstoptime = 'AcctStopTime IS NULL';
+    }
   }
   push @where, $acctstoptime;