1 <% include( 'elements/browse.html',
2 'title' => 'Rate plans',
3 'menubar' => \@menubar,
4 'html_init' => $html_init,
5 'name' => 'rate plans',
6 'query' => { 'table' => 'rate',
8 'order_by' => 'ORDER BY ratenum',
10 'count_query' => $count_query,
16 'agent_null_right' => 'Configuration', #'Edit global CDR rates',
17 'really_disable_download' => 1
22 my $all_countrycodes = join("\n", map qq(<OPTION VALUE="$_">$_),
23 FS::rate_prefix->all_countrycodes
28 my $ratenum = $rate->ratenum;
30 qq( <FORM METHOD="GET" ACTION="${p}edit/rate.cgi">
31 <INPUT TYPE="hidden" NAME="ratenum" VALUE="$ratenum">
32 <SELECT NAME="countrycode" onChange="this.form.submit();">
33 <OPTION SELECTED>Select Country Code
34 <OPTION VALUE="">(all)
44 'Rate plans for VoIP and call billing.<BR><BR>'.
45 qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!.
46 qq! | <A HREF="${p}misc/copy-rate_detail.html"><I>Copy rates between plans</I></A>!.
49 function rate_areyousure(href) {
50 if (confirm("Are you sure you want to delete this rate plan?") == true)
51 window.location.href = href;
56 my $count_query = 'SELECT COUNT(*) FROM rate';
58 my $link = [ $p.'edit/rate.cgi?ratenum=', 'ratenum' ];
63 my $curuser = $FS::CurrentUser::CurrentUser;
66 unless $curuser->access_right('Edit CDR rates')
67 #|| $curuser->access_right('Edit global CDR rates')
68 || $curuser->access_right('Configuration');
71 if ( $curuser->access_right('Configuration') ) { #, 'Edit global CDR rates') ) {
73 'Regions and Prefixes' => $p.'browse/rate_region.html',
74 'Time Periods' => $p.'browse/rate_time.html',
75 'CDR Types' => $p.'edit/cdr_type.cgi',
83 if ( FS::Record->scalar_sql('SELECT 1 FROM rate WHERE agent_rateid IS NOT NULL LIMIT 1') ) {
84 push @header, 'Legacy #';
85 push @fields, 'agent_rateid';
89 push @header, 'Rate plan', 'Rates';
90 push @fields, 'ratename', $rates_sub;
91 push @links, $link, '';