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>
Mon, 13 Jun 2016 20:31:13 +0000 (13:31 -0700)
rt/lib/RT/Search/UnrepliedTickets.pm
rt/share/html/Elements/QueueSummaryByLifecycle
rt/share/html/NoAuth/css/freeside3/ticket-lists.css

index a4fdacd..1be6686 100644 (file)
@@ -31,16 +31,21 @@ sub Prepare  {
 
   my $TicketsObj = $self->TicketsObj;
   # bypass the pre-RT-4.2 TicketRestrictions stuff and just use SearchBuilder
-  $TicketsObj->RT::SearchBuilder::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->RT::SearchBuilder::Limit(
+      FIELD => 'Owner',
+      VALUE => $TicketsObj->CurrentUser->id
+    );
+  }
   $TicketsObj->RT::SearchBuilder::Limit(
     FIELD => 'Status',
     OPERATOR => '!=',
     VALUE => 'resolved'
   );
-  $TicketsObj->Limit(
+  $TicketsObj->RT::SearchBuilder::Limit(
     FIELD => 'Status',
     OPERATOR => '!=',
     VALUE => 'rejected',
index da31ebb..6c45cfd 100644 (file)
@@ -66,9 +66,13 @@ for my $queue (@queues) {
     next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name;
 
     $i++;
+
+    my $classes = $i%2 ? 'oddline' : 'evenline';
+    $classes .= ' unreplied-ticket' if $queue->{Unreplied} > 0;
 </%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>
@@ -131,6 +135,24 @@ for my $queue (@queues) {
     $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' ) {
index 257cf3b..efcc2c8 100644 (file)
@@ -108,7 +108,7 @@ tr.unreplied-ticket > :first-child::before {
     width: 1ex;
     float: left;
     content: '';
-    margin-top: 1ex;
+    margin-right: 1ex;
     background-color: green;
 }