[rt-users] Can I see which tickets have been replied to?

Bruce Campbell bruce_campbell at ripe.net
Tue Mar 11 09:20:16 EST 2003


On Mon, 10 Mar 2003, Ron Gidron wrote:

> When I log into RT I can see all of the tickets I am assigned to, the
> problem is that I cannot distinguish between those tickets that have
> been updated by the requestor (or anyone else but me for that matter)?
> is there a way to see this?

Apart from 'wait 6 hours, then try again' ? ;)

I presume that you are referring to the main home page of an RT
installation, where the summary of tickets is given.  The obvious solution
is to check the last item of each ticket in the summary, and see whether
it was the requestor or an AdminCc who updated it.

This sounds easy; just a trifle in fact.  Right?  Actually, its not as
easy as that.  Firstly, remember that RT is a database-driven application.
Secondly, the summary page of 'top 25' stuff is already doing a lot of
database queries to generate that information, and its doing this each
time.  Adding extra queries might well make your wait intolerable.

Having said that, heres a little snippet that might do what you want, for
RT2 (as I don't believe you specified which RT version you are using).

-- 
                             Bruce Campbell                            RIPE
                   Systems/Network Engineer                             NCC
                 www.ripe.net - PGP562C8B1B             Operations/Security

-- WebRT/Elements/MyTickets
<& /Elements/TitleBoxStart, title => "25 highest priority tickets I own..." &>
<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
<TR>
<TH ALIGN=RIGHT>#</TH>
<TH ALIGN=LEFT>Subject</TH>
<TH ALIGN=LEFT>Queue</TH>
<TH ALIGN=LEFT>Status</TH>
<TH ALIGN=LEFT> </TH>
</TR>
% while (my $Ticket = $MyTickets->Next) {
%  # Fill in the cache of QueueAdminCcs (remember that someone might be in
%  # multiple queues, and thus AdminCc in one might be Joe Average in another )
%  if( ! defined( $MyAdminCache{$Ticket->QueueObj->id} ) ){
%    my $taccs = $Ticket->QueueObj->AdminCc;
%    while( my $tmpacc = $taccs->Next() ){
%      $MyAdminCache{$Ticket->QueueObj->id}{$tmpacc->OwnerObj->id}++;
%    }
%  }
<TR>
<TD ALIGN=RIGHT>
<%$Ticket->Id%>
</TD>
<TD>
<A HREF="<% $RT::WebPath %>/Ticket/Display.html?id=<%$Ticket->Id%>">
<%$Ticket->Subject || '[no subject]'%>
</A>
</TD>
<TD>
<%$Ticket->QueueObj->Name%>
</TD>
% # We'll use red if the requestor last did something, green if an AdminCc
% # did something.
% my $transactions = $Ticket->Transactions;
% # go backwards in transactions.
% $transactions->OrderBy( FIELD => 'id', VALUE => 'DESC' );
% my $havelast = 0;
% # 'yellow' for unknown status.
% my $colour = "yellow";
% while( ($havelast == 0 ) && ( my $trans = $transactions->Next() ) ){
%   next unless( $trans->Type() eq 'Correspond' || $thistrans->Type() eq 'Create' );
%   $havelast++;
%   if( defined( $MyAdminCache{$Ticket->QueueObj->id}{$trans->CreatorObj->id} ) ){
%      $colour="green";
%   }else{
%      $colour="red";
%   }
% }
<TD BGCOLOR="<%$colour%>">
<%$Ticket->Status%>
</TD>
<TD ALIGN=RIGHT>
[<A HREF="<% $RT::WebPath %>/Ticket/Update.html?id=<%$Ticket->Id%>">Update</A>]
</TD>
</TR>
% }
</TABLE>
<& /Elements/TitleBoxEnd &>


<%INIT>
my $MyTickets;
$MyTickets = new RT::Tickets ($session{'CurrentUser'});
$MyTickets->LimitOwner(VALUE => $session{'CurrentUser'}->Id);
$MyTickets->LimitStatus(VALUE => "open");
$MyTickets->LimitStatus(VALUE => "new");
$MyTickets->OrderBy(FIELD => 'Priority', ORDER => 'DESC');
$MyTickets->RowsPerPage(25);

my %MyAdminCache = ();

</%INIT>





More information about the rt-users mailing list