X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Frate_region.cgi;h=04f285f3709774d53a3afb9a80099f3b423a44e7;hb=5e05724a635a22776f1b973f5d7e77989da4e048;hp=12cb180de217d39f9301d2b32226a4c1d343aa67;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index 12cb180de..04f285f37 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -1,84 +1,64 @@ - -% -% -%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') %>
+%# region info + <% ntable('#cccccc') %> - - Region name - - - - Country code - - + + Region name + + + + Country code + + - - Prefixes - - - - + + + Prefixes +
(comma-separated) + + + + + +%# rate plan info +
-<% table() %> - - Rate plan - Included
minutes
- Charge per
minute
- Granularity - + +<% include('/elements/table-grid.html') %> +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = ''; + + + + Rate plan + + + Included
minutes/calls
+ + + Charge per
minute/call
+ + + Granularity + + + % foreach my $rate ( qsearch('rate', {}) ) { % % my $n = $rate->ratenum; @@ -88,32 +68,86 @@ % 'sec_granularity' => '60' % }; % -% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } - <% $rate->ratename %> - min_included %>"> - $min_charge ) %>"> - - min_included |h %>"> + + + + $min_charge ) %>"> + + + + + + -% } +% } -

"> - - - - - +

+"> + + + +<% 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', + '1', => '1 second', + '6' => '6 second', + '30' => '30 second', # '1/2 minute', + '60' => 'minute', + '0' => 'call', +; + +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; + } +} + +