Cloning a transaction into another ticket

Hello,

Often a person or a group of people have several open tickets for different
things and from time to time they will reply to an incorrect one. I’d like
to have the option either to move or to copy such misdirected correspondence
into the right ticket. Moving seems like a bad idea, because it could break
a lot of internal references, not to mention it’s simply not possible within
RT. So I feel like I’m only left with the option to copy a transaction into
a specified ticket and that’s fine. While copying a transaction is
relatively easy through RT::Record->_NewTransaction, I have a problem with
cloning attachments. It looks like the RT code expects a complete MIME
object that it could split on its own into attachment records, but all I can
get will already be broken down to RT::Attachment objects. Is there a way to
approach this?

Maciek

In the mean time I have found out an easier way of doing what I want:

my $transaction = RT::Transaction->new(RT::SystemUser);
$transaction->Load(43397);
my $user = RT::User->new(RT::SystemUser);
$user->Load($transaction->Creator);
my $ticket = RT::Ticket->new($user);
$ticket->Load(4747);
$ticket->Correspond(Content => $transaction->Content);

But this only gets me the message text copied into the other ticket. But
since Correspond method can take MIMEObj, I guess my question now is if
there’s an easy way of recreating MIMEObj from transaction and its
attachments?

Maciek

$ticket->Correspond(Content => $transaction->Content);

I think
$ticket->Correspond(Content => $transaction->ContentAsMIME);
is what you search for.

Chris

I think
$ticket->Correspond(Content => $transaction->ContentAsMIME); is what you
search for.

Chris

Thanks Chris. Indeed. I missed that somehow. Actually, I am less interested
in Transaction::ContentAsMIME, which builds a message/rfc822 message, but
Attachment::ContentAsMIME does exactly what I need. As I started using it, I
also discovered that it most likely has a bug that prevents it from working
correctly for many multipart messages
(Login).

Best regards,
Maciek