[rt-users] Canned Responses
Stephen Turner
sturner at MIT.EDU
Thu Feb 22 10:16:07 EST 2007
At Wednesday 2/21/2007 03:35 PM, Dalal, Kamber Z (Kamber) wrote:
>Steve,
>
>Thank you for the assistance. Please excuse my ignorance,
>
>In the wiki you mentioned:
>"One limitation is that the transaction object can't be used in the
>template - I just pass in a blank transaction object to the template
>parsing routine."
>
>I believe that is what is now in the way. In one of the templates the
>first line of the content is:
>Subject: Notify: ($Ticket->Subject)
>
>And in the second template's content I left the first 3 lines blank.
>
>What do you mean by "I just pass in a blank transaction object to the
>template parsing routine."
>
>
>Thank you,
>Kamber
Kamber,
In the usual RT usage of templates (i.e. in creating email messages),
there's a transaction object available to the template, and it's
referenced by $Transaction.
In my canned replies code, there is no associated transaction - the
code is executed in the context of a ticket, not a transaction.
However, the Template->parse() method expects a transaction object as
an argument. So I create a blank, or empty, transaction object and
pass that in:
my $trans = new RT::Transaction( $session{'CurrentUser'} );
$template->Parse(TicketObj => $TicketObj,
TransactionObj => $trans);
So you should be fine as long as you don't use $Transaction in the templates.
Steve
More information about the rt-users
mailing list