I’m new to the list. I’ve been exploring RT for about a month, trying to
familiarise myself with RT as well as to see how I can customise it for my
purposes. Had some success creating a custom scrip. I’m now trying to work
on a 2nd scrip to perform some additional processing of attachments outside
of RT. My idea goes as follows:
User creates a ticket and attaches a binary file to it. Within RT, the
ticket will have a life of its own.
Next, I would like to run a scrip upon the ticket creation to detect the
attachment’s existence (eg. specific filename) and send that attachment to
be processed by another software. The other software is able to monitor a
folder to pick up new files for processing, so to put it simply, the scrip
should be able to ‘export’ the attachment to the filesystem and put it in a
specific folder.
I’ve looked through the RT::Attachment documentation, experimented with it,
and also searched through the RT mailing list archives. The best I can do
is to display the content of the attachment, but I cannot figure out how to
’export’ an attachment to the filesystem. Is this even possible within RT?
I’ve not come across anyone discussing anything similar.
I’ve looked through the RT::Attachment documentation, experimented with
it, and also searched through the RT mailing list archives. The best I can
do is to display the content of the attachment, but I cannot figure out
how to ‘export’ an attachment to the filesystem. Is this even possible
within RT? I’ve not come across anyone discussing anything similar.
here is an example I used to dump tickets to files:
my $Attachments = $Transaction->Attachments;
$Attachments->OrderBy( FIELD => 'id', ORDER => 'ASC' );
while ( my $Attachment = $Attachments->Next ) {
next unless ( $Attachment->Filename );
my $filename = $Attachment->Filename;
$filename =~ s/\//-/g;
my $file_path = $attachments_dir."/".$Ticket->id."-".$filename;
open( FILE, '>' ,$file_path ) or die "Can't open $file_path: $!\n";
print FILE $Attachment->OriginalContent;
close ( FILE );
}