1 <% include( 'elements/process.html',
2 'table' => 'msg_template',
4 'viewall_url' => "browse/msg_template/$msgclass.html",
6 'precheck_callback' => \&precheck_callback,
7 'args_callback' => \&args_callback,
12 unless $FS::CurrentUser::CurrentUser->access_right(['Edit templates','Edit global templates']);
14 my $msgclass = 'email';
15 if ( $cgi->param('msgclass') =~ /^(\w+)$/ ) {
19 my $fields = [ fields('msg_template') ];
20 my $class = "FS::msg_template::$msgclass";
22 if ( $class->extension_table ) {
23 push @$fields, fields($class->extension_table);
26 sub precheck_callback {
28 # validate locale field (for email-type records)
29 $cgi->param('locale') =~ /^(\w*)$/;
31 return mt('Language required') if $locale eq 'new'; # the user didn't choose
32 die "unknown locale $locale" if ( $locale and
33 !FS::Locales->locale_info($locale) );
37 my ($cgi, $object) = @_;
39 $cgi->param('locale') =~ /^(\w*)$/;
40 $content{'locale'} = $1;
41 # no validation of these; they can contain just about anything
42 $content{'subject'} = $cgi->param('subject') || '';
43 $content{'body'} = $cgi->param('body') || '';