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

Expose custom field values in simple templates

parent 33817439
......@@ -534,6 +534,12 @@ sub _MassageSimpleTemplateArgs {
$template_args->{"TicketOwnerId"} = $ticket->Owner;
$template_args->{"TicketOwnerName"} = $ticket->OwnerObj->Name;
$template_args->{"TicketOwnerEmailAddress"} = $ticket->OwnerObj->EmailAddress;
my $cfs = $ticket->CustomFields;
while (my $cf = $cfs->Next) {
$template_args->{"TicketCF" . $cf->Name} = $ticket->CustomFieldValuesAsString($cf->Name);
}
}
if (my $txn = $template_args->{Transaction}) {
......
use strict;
use warnings;
use RT;
use RT::Test tests => 191;
use RT::Test tests => 203;
my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Create(
Name => 'Department',
Queue => '0',
SortOrder => '1',
Description => 'A testing custom field',
Type => 'FreeformSingle',
);
my $ticket = RT::Ticket->new($RT::SystemUser);
my ($id, $msg) = $ticket->Create(
......@@ -12,6 +21,10 @@ my ($id, $msg) = $ticket->Create(
);
ok($id, "Created ticket");
$ticket->AddCustomFieldValue(
Field => 'Department',
Value => 'Coolio',
);
TemplateTest(
Content => "\ntest",
......@@ -79,6 +92,11 @@ TemplateTest(
SimpleOutput => "test #" . $ticket->id,
);
TemplateTest(
Content => "\ntest { \$TicketCFDepartment }",
FullOutput => "test ",
SimpleOutput => "test Coolio",
);
TemplateTest(
Content => "\ntest { \$Nonexistent }",
......
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