X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fmsg_template.html;h=50afc283e75450ff35c649ec2a902639679e0988;hb=217b71622d3898e6df98832d378312aa70d6ae7e;hp=8a6ccf741b2a110fc8b4ca24f737540b2abb04e1;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/httemplate/browse/msg_template.html b/httemplate/browse/msg_template.html index 8a6ccf741..50afc283e 100644 --- a/httemplate/browse/msg_template.html +++ b/httemplate/browse/msg_template.html @@ -1,29 +1,32 @@ <% include( 'elements/browse.html', 'title' => 'Message templates', 'name_singular' => 'template', - 'menubar' => [ 'Add a new template' => - $p.'edit/msg_template.html', - ], - 'query' => { 'table' => 'msg_template', }, - 'count_query' => 'SELECT COUNT(*) FROM msg_template', - 'disableable' => 1, + 'menubar' => \@menubar, + 'query' => { 'table' => 'msg_template', }, + 'count_query' => 'SELECT COUNT(*) FROM msg_template', + 'disableable' => 1, 'disabled_statuspos' => 2, 'agent_virt' => 1, - 'agent_null_right' => ['Edit global templates','Configuration'], + 'agent_null_right' => ['View global templates','Edit global templates'], 'agent_pos' => 1, - 'header' => [ 'Name', '', ('' x scalar @locales) ], - 'fields' => [ 'msgname', @locales ], - 'links' => [ $link, @locale_links ], - 'cell_style' => - [ '', '', ($locale_style) x (scalar @locales) ], + 'header' => [ 'Name', '', map '', @locales ], + 'fields' => [ 'msgname', @locales ], + 'links' => [ $link, @locale_links ], + 'cell_style' => [ '', '', map $locale_style, @locales ], ) %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + 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 $curuser->access_right([ 'View templates', 'View global templates', + 'Edit templates', 'Edit global templates', ]); + +my @menubar = (); +if ( $curuser->access_right(['Edit templates', 'Edit global templates']) ) { + push @menubar, 'Add a new template' => $p.'edit/msg_template.html'; +} my $link = [ "${p}edit/msg_template.html?msgnum=", 'msgnum' ];