<% include("/elements/header.html","$action Region", menubar( 'View all regions' => "${p}browse/rate_region.html", )) %> <% include('/elements/error.html') %>
%# region info <% ntable('#cccccc') %> Region name Country code Prefixes
(comma-separated) %# rate plan info
<% include('/elements/table-grid.html') %> % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; % my $bgcolor = ''; Rate plan Included
minutes/calls
Charge per
minute/call
Granularity Usage class % foreach my $rate ( qsearch('rate', {}) ) { % % my $n = $rate->ratenum; % my $rate_detail = $rate->dest_detail($rate_region) % || new FS::rate_region { 'min_included' => 0, % 'min_charge' => 0, % 'sec_granularity' => '60' % }; % % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; % } else { % $bgcolor = $bgcolor1; % } <% $rate->ratename %> min_included |h %>"> $min_charge |h %>"> <% include( '/elements/select-table.html', 'element_name' => "classnum$n", 'table' => 'usage_class', 'name_col' => 'classname', 'empty_label' => '(default)', 'hashref' => { disabled => '' }, 'curr_value' => ( $cgi->param("classnum$n") || $rate_detail->classnum ), ) %> % }

">
<% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $rate_region; if ( $cgi->param('error') ) { $rate_region = new FS::rate_region ( { map { $_, scalar($cgi->param($_)) } fields('rate_region') } ); } elsif ( $cgi->keywords ) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/ or die "unparsable regionnum"; $rate_region = qsearchs( 'rate_region', { 'regionnum' => $1 } ) or die "unknown regionnum $1\n"; } else { #adding $rate_region = new FS::rate_region {}; } my $action = $rate_region->regionnum ? 'Edit' : 'Add'; my $p1 = popurl(1); tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); my @rate_prefix = $rate_region->rate_prefix; my $countrycode = ''; if ( @rate_prefix ) { $countrycode = $rate_prefix[0]->countrycode; foreach my $rate_prefix ( @rate_prefix ) { errorpage('multiple country codes per region not yet supported by web UI') unless $rate_prefix->countrycode eq $countrycode; } }