[rt-users] scanning active ticket contents in perl
Robert Eden
rmeden at gmail.com
Tue Sep 8 17:58:15 EDT 2009
Howdy all...
I'd like to write a special report and in order to do so, I need to get
info from scanning replies and comments of tickets.
This shouldn't be hard, but I just can't figure it out. I've read the
RT Essentials book, the wiki, some sample code... I'm close... just
can't seem to close the deal!
My first question is where should I be looking for this sort of info? I
couldn't find any sample code for offline reporting. I find that
strange. I also can't find all the methods and attributes of the RT
objects documented anywhere.
Here's my code snippet. The Transactions->Next seems to be looping
rather than stepping through each transaction.
$tickets->LimitStatus(VALUE => 'new');
$tickets->LimitStatus(VALUE => 'open');
while (my $Ticket = $tickets->Next) {
print "Ticket ".$Ticket->id."\n";
while (my $txn = $Ticket->Transactions->Next) {
print "Txn ".$txn->id."\n";
my $attachments = RT::Attachments->new($txn->CurrentUser);
$attachments->Limit( FIELD => 'TransactionID', VALUE => $txn->id );
$attachments->OrderBy( FIELD => 'Id', ORDER => 'ASC' );
while ( my $a = $attachments->Next ) {
print "ContentType=".$a->ContentType."\n";
print "ContentEncoding=".$a->ContentEncoding."\n";
print "Content:".substr($a->Content,0,100)."\n";
}
}
die "stop here" if $count++>5;
}
More information about the rt-users
mailing list