rename WebExternalAutoInfo to WebRemoteUserAutocreateInfo, #37318
[freeside.git] / rt / lib / RT / Action / ExtractCustomFieldValuesWithCodeInTemplate.pm
1 package RT::Action::ExtractCustomFieldValuesWithCodeInTemplate;
2 use strict;
3 use warnings;
4
5 use base qw(RT::Action::ExtractCustomFieldValues);
6
7 sub TemplateContent {
8     my $self = shift;
9     my $is_broken = 0;
10
11     my $content = $self->TemplateObj->Content;
12
13     my $template = Text::Template->new(TYPE => 'STRING', SOURCE => $content);
14     my $new_content = $template->fill_in(
15         BROKEN => sub {
16             my (%args) = @_;
17             $RT::Logger->error("Template parsing error: $args{error}")
18                 unless $args{error} =~ /^Died at /; # ignore intentional die()
19             $is_broken++;
20             return undef;
21         },
22     );
23
24     return (undef, $self->loc('Template parsing error')) if $is_broken;
25
26     return $new_content;
27 }
28
29 1;
30