[rt-users] Help with Templates
Thomas Westlund
thomas at westlund.no
Wed Dec 17 06:38:45 EST 2014
Hi,
There seems to be an error in the code:
This is my complete template
======= CUT HERE ======
Subject: Ordrestatus: { $Ticket->SubjectTag }
Hei,
Her kommer ditt tilbud.
Vennligst behold:
{ $Ticket->SubjectTag }
emnefeltet ved fremtidig korrespodanse i denne saken.
Mvh,
Kvantel AS
{$Ticket->QueueObj->CorrespondAddress()}
---------------------------------------------------------------------------
Related ticket IDs:
{
my @refers_to_ids;
my $refers_to = $Ticket->RefersTo;
while (my $link = $refers_to->Next) {
next unless $link->BaseURI->IsLocal;
push @refers_to_ids, $link->BaseObj->id;
}
return join(q{, }, map { "#$_" } sort @refers_to_ids;
}
======= CUT HERE ======
When I try to save this template, I get the following error:
* Template Tilbud: Content updated
* Couldn't compile template codeblock ' my @refers_to_ids; my $refers_to = $Ticket->RefersTo; while (my $link = $refers_to->Next) { next unless $link->BaseURI->IsLocal; } return join(q{, }, map { "#$_" } sort @refers_to_ids; ': syntax error at template line 28
--
Regards
Thomas
Fra: Alex Peters [mailto:alex at peters.net]
Sendt: 17. desember 2014 11:57
Til: Thomas Westlund
Kopi: rt-users at lists.bestpractical.com
Emne: Re: [rt-users] Help with Templates
Simply copy everything between (and including) the outermost curly braces in the location where you'd like a comma-separated list of ticket numbers to appear.
Basically any curly brace construct will be replaced with something else when the template is evaluated.
On 17 December 2014 at 18:36, Thomas Westlund <thomas at westlund.no <mailto:thomas at westlund.no> > wrote:
Hi,
Thanks for your reply
I'm fairly new RT an my perl skills at not to good either.
How would I go about outputting this in a template?
--
Thomas
On 17. des. 2014, at 00.28, Alex Peters <alex at peters.net <mailto:alex at peters.net> > wrote:
You're getting an RT::Links instance, which is an iterator. I've used something like this with success:
Related ticket IDs: {
my @refers_to_ids;
my $refers_to = $Ticket->RefersTo;
while (my $link = $refers_to->Next) {
next unless $link->BaseURI->IsLocal; # skip over non-ticket links
push @refers_to_ids, $link->BaseObj->id;
}
return join(q{, }, map { "#$_" } sort @refers_to_ids;
}
On 17 December 2014 at 07:51, Thomas Westlund <thomas at westlund.no <mailto:thomas at westlund.no> > wrote:
Hi,
I want to display the ID of related Tickets in my template
I tried using this {$Ticket->RefersTo}
But that just returns RT::Links=HASH(0x7f6dc46f7d20)
How can I expand this to the ID of the related object?
Regards
--
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20141217/80b44725/attachment.htm>
More information about the rt-users
mailing list