[Rt-commit] r9418 - in rt/branches/3.6-RELEASE: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Oct 23 14:14:24 EDT 2007


Author: sartak
Date: Tue Oct 23 14:14:23 2007
New Revision: 9418

Modified:
   rt/branches/3.6-RELEASE/   (props changed)
   rt/branches/3.6-RELEASE/lib/RT/Template_Overlay.pm

Log:
 r44066 at onn:  sartak | 2007-10-23 14:14:02 -0400
 Allow Template->ParseContent to not require Ticket and Txn


Modified: rt/branches/3.6-RELEASE/lib/RT/Template_Overlay.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Template_Overlay.pm	(original)
+++ rt/branches/3.6-RELEASE/lib/RT/Template_Overlay.pm	Tue Oct 23 14:14:23 2007
@@ -299,7 +299,8 @@
  This routine performs Text::Template parsing on the template and then
  imports the results into a MIME::Entity so we can really use it
 
- Takes a hash containing Argument, TicketObj, and TransactionObj.
+ Takes a hash containing Argument, TicketObj, and TransactionObj. TicketObj
+ and TransactionObj are not mandatory, but highly recommended.
 
  It returns a tuple of (val, message)
  If val is 0, the message contains an error message
@@ -365,9 +366,13 @@
     local $T::Ticket      = $args{'TicketObj'};
     local $T::Transaction = $args{'TransactionObj'};
     local $T::Argument    = $args{'Argument'};
-    local $T::Requestor   = eval { $T::Ticket->Requestors->UserMembersObj->First->Name };
+    local $T::Requestor   = eval { $T::Ticket->Requestors->UserMembersObj->First->Name } if $T::Ticket;
     local $T::rtname      = $RT::rtname;
-    local *T::loc         = sub { $T::Ticket->loc(@_) };
+
+    local *T::loc         = sub {
+        $T::Ticket ? $T::Ticket->loc(@_)
+                   : $self->CurrentUser->loc(@_)
+    };
 
     my $content = $self->Content;
     unless ( defined $content ) {


More information about the Rt-commit mailing list