[rt-users] Perl API: list of available queues, owners, status
Tim Cutts
tjrc at sanger.ac.uk
Fri Jul 13 16:59:49 EDT 2012
On 13 Jul 2012, at 15:51, Kevin Falcone wrote:
> You really don't want to go about it that way.
> You want to ask the Queue for the valid statuses, which is why I
> pointed to the perldoc for Queue.pm.
> A Queue object can get you both global and queue specific sets of
> statuses, and it can also tell you if a Status is valid for a given
> Queue.
I stand corrected.
>>> and also
>>> the list of names of ticket owners.
>>
>> Well, you can always construct that from any list of tickets that you've previously obtained. The method is similar to the one mentioned before for iterating over queues; instead, you iterate over the tickets and fetch the name of the owner from each one. Note that this is likely to be quite slow if there are a lot of tickets.
>>
>> You could, of course query the database directly, with something like:
>>
>> select distinct(u.Name) from Users u, Tickets t where t.Owner = u.id;
>>
>> but querying the database directly is not generally considered a smart thing to do, although I doubt this part of the schema is going to change any time soon.
>
> This is a list of people who are currently Owners, which is not
> actually the same as people who can be owners.
I must have misinterpreted the question. If that's what he's after, then I'd have looked at the Mason components which provide a list of possible owners for a ticket, and copy the way that does it.
Regards,
Tim
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
More information about the rt-users
mailing list