Commit bbf46263 authored by Shawn M Moore's avatar Shawn M Moore
Browse files

Add queue and owner variables to simple templates

parent d32274b5
......@@ -524,9 +524,22 @@ sub _MassageSimpleTemplateArgs {
my $template_args = $args{TemplateArgs};
if (my $ticket = $template_args->{Ticket}) {
for my $column (qw/Subject/) {
for my $column (qw/Subject Queue/) {
$template_args->{"Ticket".$column} = $ticket->$column;
}
$template_args->{"TicketQueueId"} = $ticket->Queue;
$template_args->{"TicketQueueName"} = $ticket->QueueObj->Name;
$template_args->{"TicketOwnerId"} = $ticket->Owner;
$template_args->{"TicketOwnerName"} = $ticket->OwnerObj->Name;
$template_args->{"TicketOwnerEmailAddress"} = $ticket->OwnerObj->EmailAddress;
}
if (my $txn = $template_args->{Transaction}) {
for my $column (qw//) {
$template_args->{"Transaction".$column} = $txn->$column;
}
}
}
......
use strict;
use warnings;
use RT;
use RT::Test tests => 107;
use RT::Test tests => 167;
my $ticket = RT::Ticket->new($RT::SystemUser);
my ($id, $msg) = $ticket->Create(
Subject => "template testing",
Queue => "General",
Owner => 'root@localhost',
Requestor => ["dom\@example.com"],
);
ok($id, "Created ticket");
......@@ -36,6 +37,36 @@ TemplateTest(
SimpleOutput => "test template testing",
);
TemplateTest(
Content => "\ntest { \$TicketQueueId }",
FullOutput => "test ",
SimpleOutput => "test 1",
);
TemplateTest(
Content => "\ntest { \$TicketQueueName }",
FullOutput => "test ",
SimpleOutput => "test General",
);
TemplateTest(
Content => "\ntest { \$TicketOwnerId }",
FullOutput => "test ",
SimpleOutput => "test 12",
);
TemplateTest(
Content => "\ntest { \$TicketOwnerName }",
FullOutput => "test ",
SimpleOutput => "test root",
);
TemplateTest(
Content => "\ntest { \$TicketOwnerEmailAddress }",
FullOutput => "test ",
SimpleOutput => "test root\@localhost",
);
TemplateTest(
Content => "\ntest { \$Nonexistent }",
FullOutput => "test ",
......@@ -56,7 +87,7 @@ TemplateTest(
TemplateTest(
Content => "\ntest { \$Ticket->OwnerObj->Name }",
FullOutput => "test Nobody",
FullOutput => "test root",
SimpleOutput => "test { \$Ticket->OwnerObj->Name }",
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment