X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Frate.cgi;h=79bebadee99a7e85ebcc39e23888b8b779d697ac;hp=0c425a5d1e685d02ae5943a9b7f4b9565e00dc3f;hb=c49cfd25a8f92c7a2f44b51d72506a21f6b8d09f;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;ds=sidebyside diff --git a/httemplate/browse/rate.cgi b/httemplate/browse/rate.cgi index 0c425a5d1..79bebadee 100644 --- a/httemplate/browse/rate.cgi +++ b/httemplate/browse/rate.cgi @@ -1,12 +1,6 @@ <% include( 'elements/browse.html', 'title' => 'Rate plans', - 'menubar' => [ 'Regions and Prefixes' => - $p.'browse/rate_region.html', - 'Time Periods' => - $p.'browse/rate_time.html', - 'CDR Types' => - $p.'edit/cdr_type.cgi', - ], + 'menubar' => \@menubar, 'html_init' => $html_init, 'name' => 'rate plans', 'query' => { 'table' => 'rate', @@ -14,9 +8,12 @@ 'order_by' => 'ORDER BY ratenum', }, 'count_query' => $count_query, - 'header' => [ '#', 'Rate plan', 'Rates' ], - 'fields' => [ 'ratenum', 'ratename', $rates_sub ], - 'links' => [ $link, $link, '' ], + 'header' => \@header, + 'fields' => \@fields, + 'links' => \@links, + 'agent_virt' => 1, + 'agent_pos' => 1, + 'agent_null_right' => 'Configuration', #'Edit global CDR rates', 'really_disable_download' => 1 ) %> @@ -63,7 +60,34 @@ my $link = [ $p.'edit/rate.cgi?ratenum=', 'ratenum' ]; <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $curuser->access_right('Edit CDR rates') + #|| $curuser->access_right('Edit global CDR rates') + || $curuser->access_right('Configuration'); + +my @menubar; +if ( $curuser->access_right('Configuration') ) { #, 'Edit global CDR rates') ) { + push @menubar, + 'Regions and Prefixes' => $p.'browse/rate_region.html', + 'Time Periods' => $p.'browse/rate_time.html', + 'CDR Types' => $p.'edit/cdr_type.cgi', + ; +} + +my @header = (); +my @fields = (); +my @links = (); + +if ( FS::Record->scalar_sql('SELECT 1 FROM rate WHERE agent_rateid IS NOT NULL LIMIT 1') ) { + push @header, 'Legacy #'; + push @fields, 'agent_rateid'; + push @links, $link; +} + +push @header, 'Rate plan', 'Rates'; +push @fields, 'ratename', $rates_sub; +push @links, $link, '';