don't display a non-sensical duration for open sessions, RT#34966
[freeside.git] / fs_selfservice / FS-SelfService / cgi / view_usage_details.html
index 9f02eba..27afe12 100644 (file)
@@ -1,10 +1,10 @@
-<%= $url = "$selfurl?session=$session_id;action="; ''; %>
-<%= include('header') %>
-
-<FONT SIZE=4>Service usage details for
-<%= Date::Format::time2str('%b&nbsp;%o&nbsp;%Y', $beginning) %> -
-<%= Date::Format::time2str('%b&nbsp;%o&nbsp;%Y', $ending) %>
-</FONT><BR><BR>
+<%= $url = "$selfurl?;action="; ''; %>
+<%= include('header', 'Service usage details for '.
+                      Date::Format::time2str('%b&nbsp;%o&nbsp;%Y', $beginning).
+                      ' - '.
+                      Date::Format::time2str('%b&nbsp;%o&nbsp;%Y', $ending)
+           )
+%>
 
 <%= if ( $error ) {
   $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
@@ -47,7 +47,9 @@
     $OUT .= '</TD><TD ALIGN="right">';
     $OUT .= Date::Format::time2str('%T%P %a&nbsp;%b&nbsp;%o&nbsp;%Y', $usage->{'acctstarttime'});
     $OUT .= '</TD><TD ALIGN="right">';
-    my $duration =  $usage->{'acctstoptime'} - $usage->{'acctstarttime'};
+    my $duration = ( $usage->{'acctstoptime'} && $usage->{'acctstarttime'} )
+                     ? ( $usage->{'acctstoptime'} - $usage->{'acctstarttime'} )
+                     : 0;
     $total += $duration;
     my $h = int($duration/3600);
     my $m = sprintf("%02d", int(($duration % 3600) / 60));