[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-214-gfa53fb4
Shawn Moore
sartak at bestpractical.com
Mon Jul 26 16:41:22 EDT 2010
The branch, new-style-templates has been updated
via fa53fb4cd6a2c4e4a3598f5e26557b977c9a88cf (commit)
from 4a53c421d116b7299205cdfc372a2317422aee90 (commit)
Summary of changes:
lib/RT/Template_Overlay.pm | 8 ++++++--
t/api/template-simple.t | 15 +++++++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit fa53fb4cd6a2c4e4a3598f5e26557b977c9a88cf
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Jul 26 16:43:12 2010 -0400
Transaction fields
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 2e34857..4669179 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -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);
+ }
}
}
diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index 2a12e59..8eaf65c 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,7 +1,7 @@
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',
@@ -91,6 +92,16 @@ SimpleTemplateTest(
);
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);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list