X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Flib%2FRT%2FTemplate_Overlay.pm;h=5950aa3eaacd0ef67c3389614f017ed89ec3e12b;hp=0b5e67d0fa15560a5ddc650362db00387364475d;hb=289340780927b5bac2c7604d7317c3063c6dd8cc;hpb=945721f48f74d5cfffef7c7cf3a3d6bc2521f5dd diff --git a/rt/lib/RT/Template_Overlay.pm b/rt/lib/RT/Template_Overlay.pm index 0b5e67d0f..5950aa3ea 100644 --- a/rt/lib/RT/Template_Overlay.pm +++ b/rt/lib/RT/Template_Overlay.pm @@ -203,10 +203,11 @@ sub LoadQueueTemplate { my $self = shift; my %args = ( Queue => undef, - Name => undef + Name => undef, + @_ ); - return ( $self->LoadByCols( Name => $args{'Name'}, Queue => {'Queue'} ) ); + return ( $self->LoadByCols( Name => $args{'Name'}, Queue => $args{'Queue'} ) ); } @@ -318,24 +319,30 @@ sub Parse { my $parser = MIME::Parser->new(); # Setup output directory for files. from RT::EmailParser::_SetupMIMEParser - if (my $AttachmentDir = eval { File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 ) }) { - # Set up output directory for files: - $parser->output_dir("$AttachmentDir"); + if ( my $AttachmentDir = + eval { File::Temp::tempdir( TMPDIR => 1, CLEANUP => 1 ) } ) + { + + # Set up output directory for files: + $parser->output_dir("$AttachmentDir"); } else { - # On some situations TMPDIR is non-writable. sad but true. - $parser->output_to_core(1); - $parser->tmp_to_core(1); + $RT::Logger->error("Couldn't write attachments to temp dir on disk. using more memory and processor."); + # On some situations TMPDIR is non-writable. sad but true. + $parser->output_to_core(1); + $parser->tmp_to_core(1); } + #If someone includes a message, don't extract it $parser->extract_nested_messages(1); + # Set up the prefix for files with auto-generated names: $parser->output_prefix("part"); + # If content length is <= 50000 bytes, store each msg as in-core scalar; # Else, write to a disk file (the default action): $parser->output_to_core(50000); - ### Should we forgive normally-fatal errors? $parser->ignore_errors(1); $self->{'MIMEObj'} = eval { $parser->parse_data($content) }; @@ -350,7 +357,6 @@ sub Parse { $self->{'MIMEObj'}->head->unfold(); return ( 1, $self->loc("Template parsed") ); - } @@ -369,12 +375,13 @@ 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(@_) }; # We need to untaint the content of the template, since we'll be working # with it