[rt-users] Modifying Results.rdf
Emmanuel Lacour
elacour at easter-eggs.com
Sat Mar 19 04:03:40 EDT 2011
On Fri, Mar 18, 2011 at 04:51:22PM -0400, Drew Hahn wrote:
> Hi All,
>
>
>
>
> What I’m hoping to see in the RSS is either the last Correspondence or
> Comment in the ticket, or the Create statement if it is new. I can change
> the command to $Ticket->Transactions->Last->Content but it will simply print
> out “This transaction appears to have no content” if the last action was
> something like an ownership change.
>
>
create a new method in local/lib/RT/Ticket_Local.pm with something like this:
sub LastMessage {
my $self = shift;
my $Transactions = $self->Transactions;
$Transactions->OrderBy(FIELD => 'Created', ORDER => 'DESC');
while ( my $Transaction = $Transactions->Next ) {
if ( $Transaction->Type =~ /^(Correspond|Comment|Create)$/ && $Transaction->Content ) {
return ($Transaction->Content);
}
}
return (undef);
}
then in Results.rdf, use $Ticket->LastMessage.
More information about the rt-users
mailing list