show unreplied ticket marker in queue summary, #41670
authorMark Wells <mark@freeside.biz>
Sun, 12 Jun 2016 06:19:11 +0000 (23:19 -0700)
committerMark Wells <mark@freeside.biz>
Sun, 12 Jun 2016 06:22:32 +0000 (23:22 -0700)
rt/lib/RT/Search/UnrepliedTickets.pm
rt/share/html/Elements/QueueSummaryByLifecycle
rt/share/static/css/freeside4/ticket-lists.css

index 4bb59d9..12d847a 100644 (file)
@@ -30,10 +30,14 @@ sub Prepare  {
   my $self = shift;
 
   my $TicketsObj = $self->TicketsObj;
   my $self = shift;
 
   my $TicketsObj = $self->TicketsObj;
-  $TicketsObj->Limit(
-    FIELD => 'Owner',
-    VALUE => $TicketsObj->CurrentUser->id
-  );
+  # if SystemUser does this search (as in QueueSummaryByLifecycle), they
+  # should get all tickets regardless of ownership
+  if ($TicketsObj->CurrentUser->id != RT->SystemUser->id) {
+    $TicketsObj->Limit(
+      FIELD => 'Owner',
+      VALUE => $TicketsObj->CurrentUser->id
+    );
+  }
   $TicketsObj->Limit(
     FIELD => 'Status',
     OPERATOR => '!=',
   $TicketsObj->Limit(
     FIELD => 'Status',
     OPERATOR => '!=',
index f21cb20..d6ed1e6 100644 (file)
@@ -66,9 +66,13 @@ for my $queue (@queues) {
     next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name;
 
     $i++;
     next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name;
 
     $i++;
+
+    my $classes = $i%2 ? 'oddline' : 'evenline';
+    $classes .= ' unreplied-ticket' if $queue->{Unreplied} > 0;
 </%PERL>
 </%PERL>
-<tr class="<% $i%2 ? 'oddline' : 'evenline'%>" >
+<tr class="<% $classes %>">
 
 
+<td></td>
 <td>
     <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
 <td>
     <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a>
 </td>
@@ -134,6 +138,24 @@ for my $queue (@queues) {
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
     $lifecycle{ lc $cycle->Name } = $cycle;
 }
 
+use RT::Search::UnrepliedTickets;
+my $Tickets = RT::Tickets->new( RT->SystemUser );
+my $Search = RT::Search::UnrepliedTickets->new( TicketsObj => $Tickets );
+$Search->Prepare;
+
+for my $queue (@queues) {
+    my $cycle = RT::Lifecycle->Load( Name => $queue->{'Lifecycle'} );
+    $lifecycle{ lc $cycle->Name } = $cycle;
+
+    # show whether there are unreplied tickets
+    # somewhat inefficient but we only use the count query
+    my $tix = $Tickets->Clone;
+    $tix->Limit(FIELD => 'Queue',
+                OPERATOR => '=',
+                VALUE => $queue->{id});
+    $queue->{Unreplied} = $tix->Count;
+}
+
 unless (@statuses) {
     my %seen;
     foreach my $set ( 'initial', 'active' ) {
 unless (@statuses) {
     my %seen;
     foreach my $set ( 'initial', 'active' ) {
index 42b343b..3d4706f 100644 (file)
@@ -90,8 +90,7 @@ tr.unreplied-ticket > :first-child::before {
     width: 1ex;
     float: left;
     content: '';
     width: 1ex;
     float: left;
     content: '';
-    margin-top: 0 auto;
-    margin-bottom: 0 auto;
+    margin-right: 1ex;
     background-color: green;
 }
 
     background-color: green;
 }