X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Frate_region.cgi;h=9dfcb3740c640fe50e034cd4707c11154f586e22;hb=0930d22ffc440f80c1b222b2e750cadbabd9e8f6;hp=cc14dd37dc0c36df9dca6618a738e3719dd01acb;hpb=48ba2845d0119c56971d5b724661aa37e73b49dd;p=freeside.git diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index cc14dd37d..9dfcb3740 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -1,5 +1,119 @@ - -<% +<% 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
+ + + 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' +% }; +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } + + + + + <% $rate->ratename %> + + + + 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') ) { @@ -8,8 +122,9 @@ if ( $cgi->param('error') ) { } ); } elsif ( $cgi->keywords ) { my($query) = $cgi->keywords; - $query =~ /^(\d+)$/; - $rate_region = qsearchs( 'rate_region', { 'regionnum' => $1 } ); + $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 {}; } @@ -17,98 +132,21 @@ my $action = $rate_region->regionnum ? 'Edit' : 'Add'; my $p1 = popurl(1); -my %granularity = ( +tie my %granularity, 'Tie::IxHash', + '1', => '1 second', '6' => '6 second', + '30' => '30 second', # '1/2 minute', '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' + errorpage('multiple country codes per region not yet supported by web UI') unless $rate_prefix->countrycode eq $countrycode; } } -%> - -<%= header("$action Region", menubar( - 'Main Menu' => $p, - #'View all regions' => "${p}browse/rate_region.cgi", - )) -%> - -<% if ( $cgi->param('error') ) { %> -Error: <%= $cgi->param('error') %>
-<% } %> - -
- - - -<%= ntable('#cccccc') %> - - Region name - - - - - Country code - - - - - - Prefixes - - - - - - - -
-<%= 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' - }; - -%> - - <%= $rate->ratename %> - min_included %>"> - $min_charge ) %>"> - - - -<% } %> - - - -

"> - - - - - - +