X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fmsg_template.html;h=d8b125ae0ade7332d2224623dc63ece89e3b0d75;hb=b71b1576c68bc40ad26592b354feace37a029f0e;hp=47fe978a8827089b81b0996f6e5e2e58f2b58d90;hpb=194a775de9252e26f9f7615969489723ffbe46cc;p=freeside.git diff --git a/httemplate/edit/process/msg_template.html b/httemplate/edit/process/msg_template.html index 47fe978a8..d8b125ae0 100644 --- a/httemplate/edit/process/msg_template.html +++ b/httemplate/edit/process/msg_template.html @@ -1,7 +1,7 @@ <% include( 'elements/process.html', 'table' => 'msg_template', - 'viewall_dir' => 'browse', - #'popup_reload'=> 1, + 'fields' => $fields, + 'viewall_url' => "browse/msg_template/$msgclass.html", 'debug' => 0, 'precheck_callback' => \&precheck_callback, 'args_callback' => \&args_callback, @@ -9,13 +9,23 @@ %> <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Edit templates') - || $FS::CurrentUser::CurrentUser->access_right('Edit global templates') - || $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $FS::CurrentUser::CurrentUser->access_right(['Edit templates','Edit global templates']); + +my $msgclass = 'email'; +if ( $cgi->param('msgclass') =~ /^(\w+)$/ ) { + $msgclass = $1; +} + +my $fields = [ fields('msg_template') ]; +my $class = "FS::msg_template::$msgclass"; +eval "use $class;"; +if ( $class->extension_table ) { + push @$fields, fields($class->extension_table); +} sub precheck_callback { my $cgi = shift; - # validate some fields + # validate locale field (for email-type records) $cgi->param('locale') =~ /^(\w*)$/; my $locale = $1; return mt('Language required') if $locale eq 'new'; # the user didn't choose @@ -31,6 +41,8 @@ sub args_callback { # no validation of these; they can contain just about anything $content{'subject'} = $cgi->param('subject') || ''; $content{'body'} = $cgi->param('body') || ''; + $object->subject(''); + $object->body(''); return %content; }