Revert "RT#41671 Fix double click prevention for all legacy buttons [renamed all...
[freeside.git] / httemplate / elements / table-tickets.html
index 6d1a45a..d722c9d 100644 (file)
@@ -5,11 +5,14 @@ View
 <A HREF="<% $res_link  %>"><% mt('resolved') |h %></A>
  <BR>
 
+% if ( @tickets ) {
+
 <& /elements/table-grid.html &>
 % my $bgcolor1 = '#eeeeee';
 %   my $bgcolor2 = '#ffffff';
 %   my $bgcolor = '';
 
+<THEAD>
 <TR>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Subject') |h %></TH>
@@ -26,6 +29,7 @@ View
   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Service') |h %></TH>
 % }
 </TR>
+</THEAD>
 
 % foreach my $ticket ( @tickets ) {
 %     my $href = FS::TicketSystem->href_ticket($ticket->{id});
@@ -91,15 +95,17 @@ View
 
 % } 
 
+%}
+
 </TABLE>
 
 <%init>
-use Date::Parse qw(str2time);
-use Date::Format qw(time2str);
 
 my %opt = @_;
 my $conf = new FS::Conf;
 
+return '' unless $conf->config('ticket_system');
+
 my $object = $opt{'object'};
 $object = $object->cust_svc if $object->isa('FS::svc_Common');
 my( @tickets )  = $object->tickets;
@@ -116,8 +122,10 @@ if ( $object->isa('FS::cust_main') ) {
                     $object->custnum,
                     { 'statuses' => [ 'resolved' ] }
                   );
-}
-elsif ( $object->isa('FS::cust_svc') ) {
+} elsif ( $object->isa('FS::cust_svc') ) {
+
+  return '' unless $object->pkgnum;
+
   $thing = 'service';
   $open_link = FS::TicketSystem->href_service_tickets($object->svcnum);
 
@@ -151,7 +159,7 @@ if ( $ss_priority ) {
 my $format = $conf->config('date_format') || '%Y-%m-%d';
 
 my $date_formatter = sub {
-  my $time = str2time($_[0], 'GMT');
+  my $time = parse_datetime($_[0], 'GMT');
   # exclude times within 24 hours of zero
   ($time > 86400) ? time2str($format, $time) : '';
 };