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

Transaction fields

parent 4a53c421
......@@ -539,13 +539,17 @@ sub _MassageSimpleTemplateArgs {
while (my $cf = $cfs->Next) {
$template_args->{"TicketCF" . $cf->Name} = $ticket->CustomFieldValuesAsString($cf->Name);
}
}
if (my $txn = $template_args->{Transaction}) {
for my $column (qw//) {
for my $column (qw/Id TimeTaken Type Field OldValue NewValue Data Content Subject Description BriefDescription/) {
$template_args->{"Transaction".$column} = $txn->$column;
}
my $cfs = $txn->CustomFields;
while (my $cf = $cfs->Next) {
$template_args->{"TransactionCF" . $cf->Name} = $txn->CustomFieldValuesAsString($cf->Name);
}
}
}
......
use strict;
use warnings;
use RT;
use RT::Test tests => 155;
use RT::Test tests => 161;
my $cf = RT::CustomField->new($RT::SystemUser);
$cf->Create(
......@@ -20,6 +20,7 @@ my ($id, $msg) = $ticket->Create(
Requestor => ["dom\@example.com"],
);
ok($id, "Created ticket");
my $txn = $ticket->Transactions->First;
$ticket->AddCustomFieldValue(
Field => 'Department',
......@@ -90,6 +91,16 @@ SimpleTemplateTest(
Output => "test Coolio",
);
SimpleTemplateTest(
Content => "\ntest #{ \$TransactionId }",
Output => "test #" . $txn->id,
);
SimpleTemplateTest(
Content => "\ntest { \$TransactionType }",
Output => "test Create",
);
SimpleTemplateTest(
Content => "\ntest { \$Nonexistent }",
Output => "test { \$Nonexistent }",
......@@ -164,7 +175,7 @@ sub IndividualTemplateTest {
my ($ok, $msg) = $t->Parse(
TicketObj => $ticket,
TransactionObj => $ticket->Transactions->First,
TransactionObj => $txn,
);
if (defined $args{Output}) {
ok($ok, $msg);
......
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