[Rt-commit] rt branch, new-style-templates, updated. rt-3.8.8-212-gb740174
Shawn Moore
sartak at bestpractical.com
Mon Jul 26 16:23:23 EDT 2010
The branch, new-style-templates has been updated
via b740174b2cb3ced6e30ac0f475345a225756a02a (commit)
via 338174397878fcecff2d121abdb8117c9ef4225a (commit)
from f8cae068f2b550957605829f2a697958cf0d69a3 (commit)
Summary of changes:
lib/RT/Template_Overlay.pm | 8 +++++++-
t/api/template-simple.t | 20 +++++++++++++++++++-
2 files changed, 26 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 338174397878fcecff2d121abdb8117c9ef4225a
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Jul 26 16:24:08 2010 -0400
Watcher fields
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index 2625650..ff2416e 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -524,7 +524,7 @@ sub _MassageSimpleTemplateArgs {
my $template_args = $args{TemplateArgs};
if (my $ticket = $template_args->{Ticket}) {
- for my $column (qw/Id Subject Type InitialPriority FinalPriority Priority TimeEstimated TimeWorked Status TimeLeft Told Starts Started Due Resolved/) {
+ for my $column (qw/Id Subject Type InitialPriority FinalPriority Priority TimeEstimated TimeWorked Status TimeLeft Told Starts Started Due Resolved RequestorAddresses AdminCcAddresses CcAddresses/) {
$template_args->{"Ticket".$column} = $ticket->$column;
}
commit b740174b2cb3ced6e30ac0f475345a225756a02a
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Jul 26 16:25:03 2010 -0400
Expose custom field values in simple templates
diff --git a/lib/RT/Template_Overlay.pm b/lib/RT/Template_Overlay.pm
index ff2416e..2e34857 100755
--- a/lib/RT/Template_Overlay.pm
+++ b/lib/RT/Template_Overlay.pm
@@ -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}) {
diff --git a/t/api/template-simple.t b/t/api/template-simple.t
index 0049ec4..06e1dce 100644
--- a/t/api/template-simple.t
+++ b/t/api/template-simple.t
@@ -1,7 +1,16 @@
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 }",
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list