[rt-users] Adding {$Transaction->Content()} to Resolved Template does not work

Blair Zajac blair at orcaware.com
Wed Jan 9 18:28:49 EST 2002


Here's the new version of the Resolved Template that prints the correspondence
(if any) that went into resolving the ticket.

If there's a simpler or better way of accomplishing this, please let me
know.

Best,
Blair

-- 
Blair Zajac <blair at orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/




Subject: Ticket Resolved: {$Ticket->Subject}

Greetings,

The issue regarding

        "{$Ticket->Subject()}",

has been resolved.  If you have any further questions or concerns,
please respond to this message.

{
  my $resolved_transaction;
  my $Transactions = $Ticket->Transactions;
  while (my $Transaction = $Transactions->Next) {
    if ($Transaction->Type eq 'Correspond') {
      $resolved_transaction = $Transaction;
    } elsif (!$Transactions->IsLast) {      
      $resolved_transaction = undef;
    }
  }

  my $resolved_message = '';

  if ($resolved_transaction) {
    my $attachments = $resolved_transaction->Attachments;
    $attachments->GotoFirstItem;

    while (my $message = $attachments->Next) {
      next unless $message->ContentType =~ m!^(text/plain|message|text$)!i;

      my $content = $message->Content;
      next unless length $content;

      my $wrapper = Text::Wrapper->new(columns=>70);
      $content = $wrapper->wrap($content);
      $resolved_message .= "$content\n";
    }
  }

  $resolved_message;
}
                        Thank you,
                        {$Ticket->QueueObj->CorrespondAddress()}




Jesse Vincent wrote:
> 
> It's a Text::Template.
> 
> perldoc Text::Template should tell you what you need to know about it.
> 
> On Wed, Jan 09, 2002 at 01:46:25PM -0800, Blair Zajac wrote:
> > Jesse Vincent wrote:
> > >
> > > On Wed, Jan 09, 2002 at 11:31:35AM -0800, Blair Zajac wrote:
> > > > When I add
> > > >
> > > >       {$Transaction->Content()}
> > > >
> > > > to the default Resolved Template to have the resolve message sent to the
> > > > requester, nothing additional is added to the email, the only thing I get is
> > > > the normal text.
> > >
> > > If you take a look, you'll note that the comment or correspondence is a
> > > seperate transaction. You'll want do something like take $Ticket->Transactions,
> > > limit it to corresondence and then pull the content of the last one..
> >
> > How does one write complicated code in a Scrip?  Trying something like
> >
> >     { join(" ", keys %\{$Ticket->Transactions\} )
> >
> > and protecting each { } gets old after a while?
> >
> > Also, how does one append to the output buffer in the right order?  If you
> > use something like
> >
> > { for my $i (1..10) \{
> >  print "$i<br>\n";
> > \} }
> >
> > then the numbers are sent to the browser even before the HTTP headers are.
> >
> > Best,
> > Blair
> >
> > >
> > >
> > > > How does one work around this?  Is this a bug?
> > >
> > > It's by design. It's design that I'm considering the best way to rework ;)
> > >
> > > Thanks,
> > > Jesse
> > >
> > > --
> > > http://www.bestpractical.com/products/rt  -- Trouble Ticketing. Free.




More information about the rt-users mailing list