X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Frate_region.cgi;h=b50d2daba8e60b362512f5ed1ba1518e350f8fae;hp=12cb180de217d39f9301d2b32226a4c1d343aa67;hb=c49cfd25a8f92c7a2f44b51d72506a21f6b8d09f;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0 diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index 12cb180de..b50d2daba 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -1,119 +1,123 @@ - -% -% -%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+)$/; -% $rate_region = qsearchs( 'rate_region', { 'regionnum' => $1 } ); -%} else { #adding -% $rate_region = new FS::rate_region {}; -%} -%my $action = $rate_region->regionnum ? 'Edit' : 'Add'; -% -%my $p1 = popurl(1); -% -%my %granularity = ( -% '6' => '6 second', -% '60' => 'minute', -%); -% -%my @rate_prefix = $rate_region->rate_prefix; -%my $countrycode = ''; -%if ( @rate_prefix ) { -% $countrycode = $rate_prefix[0]->countrycode; -% foreach my $rate_prefix ( @rate_prefix ) { -% eidiot 'multiple country codes per region not yet supported by web UI' -% unless $rate_prefix->countrycode eq $countrycode; -% } -%} -% -% - - <% include("/elements/header.html","$action Region", menubar( - 'Main Menu' => $p, - #'View all regions' => "${p}browse/rate_region.cgi", + 'View all regions' => "${p}browse/rate_region.html", )) %> -% if ( $cgi->param('error') ) { - -Error: <% $cgi->param('error') %>
-% } +<% include('/elements/error.html') %>
-<% ntable('#cccccc') %> - - Region name - - - - - Country code - - +%# region info + - - - - +% if ( $rate_region->agent_regionid ) { + + + + +% } -
Prefixes - -
Legacy #<% $rate_region->agent_regionid |h %>
+ + Region name + + -
-<% table() %> - - Rate plan - Included
minutes
- Charge per
minute
- Granularity - -% 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' -% }; -% -% + + Country code + + - <% $rate->ratename %> - min_included %>"> - $min_charge ) %>"> + + Prefixes +
(comma-separated) + - + + -% } + <& /elements/tr-checkbox.html, + label => 'Exact match', + field => 'exact_match', + cell_style => 'font-weight: bold', + value => 'Y', + curr_value => $rate_region->exact_match + &> -

"> - - - - - - +
+"> + +%# rate plan info, if the region has been created yet + +% if($rate_region->regionnum) { +

Rates in this region +% if ( my $select_cdr_type = include('/elements/select-cdr_type.html', +% 'curr_value' => $cdrtypenum, +% 'onchange' => 'form.submit();', +% 'name_col' => 'cdrtypename', +% 'value_col' => 'cdrtypenum', +% 'empty_label' => '(default)', +% ) ) { +
+ +Usage type: <% $select_cdr_type %> +
+% } +<% include('/edit/elements/rate_detail.html', + 'regionnum' => $rate_region->regionnum, + 'cdrtypenum' => $cdrtypenum, +) %> +% } + +<% include('/elements/footer.html') %> +<%once> + +tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs(); + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $conf = new FS::Conf; +my $money_char = $conf->config('money_char') || '$'; + +my $rate_region; +if ( $cgi->param('error') ) { + $rate_region = new FS::rate_region ( { + map { $_, scalar($cgi->param($_)) } fields('rate_region') + } ); +} elsif ( $cgi->param('regionnum') ) { + $cgi->param('regionnum') =~ /^(\d+)$/ or die "unparseable 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; + } +} +my $cdrtypenum = ''; +if ( $cgi->param('cdrtypenum') =~ /^(\d+)$/ ) { + $cdrtypenum = $1; +} +