"Found N tickets" incorrectly includes deleted tickets

The “Found N tickets” title erroneously includes deleted tickets which
happen to match the search criteria.
The below patch seems to fix this for me, but I don’t understand the TODO
comment, so I’m not sure whether I have missed something. Does anyone have
any comments, before I send this to rt-bugs@… ?

Max.

diff -ru rt-3-0-6-pure/lib/RT/Tickets_Overlay.pm lib/RT/Tickets_Overlay.pm
— rt-3-0-6-pure/lib/RT/Tickets_Overlay.pm 2003-09-25
21:31:07.000000000 +
100
+++ lib/RT/Tickets_Overlay.pm 2003-11-07 18:58:41.000000000 +0000
@@ -1759,18 +1760,11 @@
my $Ticket = $self->SUPER::Next();
if ((defined($Ticket)) and (ref($Ticket))) {

  •       #Make sure we _never_ show deleted tickets
    
  •       #TODO we should be doing this in the where clause.
    
  •       #but you can't do multiple clauses on the same field just yet :/
    
  •       if ($Ticket->__Value('Status') eq 'deleted') {
    
  •           return($self->Next());
    
  •       }
           # Since Ticket could be granted with more rights instead
           # of being revoked, it's ok if queue rights allow
           # ShowTicket.  It seems need another query, but we have
           # rights cache in Principal::HasRight.
    
  •       elsif ($Ticket->QueueObj->CurrentUserHasRight('ShowTicket') ||
    
  •       if ($Ticket->QueueObj->CurrentUserHasRight('ShowTicket') ||
                  $Ticket->CurrentUserHasRight('ShowTicket')) {
              return($Ticket);
          }
    

@@ -1974,6 +1968,7 @@
#print Dumper($data);
push @{$clause{$realfield}}, $data;
}

  • push @{$clause{‘Status’}}, [ ‘AND’, ‘ENUM’, ‘Status’, ‘!=’, ‘deleted’ ];
    return %clause;
    }