[rt-devel] Logic of RT::Tickets::Limit*?

Rich Lafferty rich+rt at lafferty.ca
Tue May 21 14:11:37 EDT 2002


I'm playing with RT::Tickets::Limit*, and I'm confuzzled.

If I have:

  my $MyTickets;
  $MyTickets = new RT::Tickets ($session{'CurrentUser'});
  $MyTickets->LimitOwner(VALUE => "Nobody");
  $MyTickets->LimitStatus(VALUE => "new");
  $MyTickets->LimitStatus(VALUE => "open");
  $MyTickets->LimitStatus(VALUE => "stalled");
  $MyTickets->OrderBy(FIELD => 'Created', ORDER => 'ASC');
  $MyTickets->RowsPerPage(25);

my current data gives me the 9 tickets that this query would give:

  select id, Queue, Owner, Subject, Status from Tickets where owner=2
  and (status = 'new' or status = 'open' or status = 'stalled');

but if I have:

  my $MyTickets;
  $MyTickets = new RT::Tickets ($session{'CurrentUser'});
  $MyTickets->LimitOwner(VALUE => "Nobody");
  $MyTickets->OrderBy(FIELD => 'Created', ORDER => 'ASC');
  $MyTickets->RowsPerPage(25);

then I only get 4, even though

  select id, Queue, Owner, Subject, Status from Tickets where owner=2;

returns 56 rows, and my DWIM guess of

  select id, Queue, Owner, Subject, Status from Tickets where owner=2
  and (status != 'dead' and status != 'resolved');

gives me 9 rows. The four that I do get all have status "new", and
some of the ones I *don't* get back *also* have status "new", so it's
not implicitly limiting status=new.

Interestingly, the four that bit of Perl code returns are the four
oldest tickets in the nine that the SQL query returns. 

Similarly, in the Search panel in WebRT, the search

   Owner = Nobody

gives me four tickets, and the search

   Owner = Nobody
   Status = new
   Status = open
   Status = stalled

gives me nine.

Am I calling on undefined behavior here, or is there some logic that 
I'm missing or misunderstanding? My assumption was that multiple
LimitFoo are OR'd, while LimitFoo is AND'd with LimitBar, and thus
that the number of results returned from one LimitOwner call would
have to be equal to or greater than the number of results returned 
by a LimitOwner combined with LimitStatus(es).

  -Rich

-- 
Rich Lafferty --------------+-----------------------------------------------
 Ottawa, Ontario, Canada    |  Save the Pacific Northwest Tree Octopus!
 http://www.lafferty.ca/    |    http://zapatopi.net/treeoctopus.html
rich at lafferty.ca -----------+-----------------------------------------------




More information about the Rt-devel mailing list