X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FTemplate_Overlay.pm;h=4ce7298a8e7669d17ea2a4f83d65c3ce8a805eb2;hp=575333ef10454631b07f0fb6994fd012d97b1a8e;hb=8103c1fc1b2c27a6855feadf26f91b980a54bc52;hpb=9c68254528b6f2c7d8c1921b452fa56064783782 diff --git a/rt/lib/RT/Template_Overlay.pm b/rt/lib/RT/Template_Overlay.pm index 575333ef1..4ce7298a8 100644 --- a/rt/lib/RT/Template_Overlay.pm +++ b/rt/lib/RT/Template_Overlay.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 or visit their web page on the internet at +# http://www.gnu.org/copyleft/gpl.html. # # # CONTRIBUTION SUBMISSION POLICY: @@ -171,7 +173,7 @@ sub Load { =head2 LoadGlobalTemplate NAME -Load the global tempalte with the name NAME +Load the global template with the name NAME =cut @@ -297,7 +299,8 @@ sub MIMEObj { 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 @@ -360,12 +363,16 @@ sub _ParseContent { ); no warnings 'redefine'; - $T::Ticket = $args{'TicketObj'}; - $T::Transaction = $args{'TransactionObj'}; - $T::Argument = $args{'Argument'}; - $T::Requestor = eval { $T::Ticket->Requestors->UserMembersObj->First->Name }; - $T::rtname = $RT::rtname; - *T::loc = sub { $T::Ticket->loc(@_) }; + 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 } if $T::Ticket; + local $T::rtname = $RT::rtname; + + local *T::loc = sub { + $T::Ticket ? $T::Ticket->loc(@_) + : $self->CurrentUser->loc(@_) + }; my $content = $self->Content; unless ( defined $content ) {