X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Frate_region.cgi;h=cae30030a2daa70ede28d5c28da581a101b54913;hp=934fe8035af4728e2c1387eae8786b17bc272675;hb=74e058c8a010ef6feb539248a550d0bb169c1e94;hpb=c1bb4ddb71147d0571bd301a6d8c452fdf0e1bc9
diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi
index 934fe8035..cae30030a 100644
--- a/httemplate/edit/rate_region.cgi
+++ b/httemplate/edit/rate_region.cgi
@@ -1,5 +1,67 @@
-
-<%
+<% include("/elements/header.html","$action Region", menubar(
+ 'View all regions' => "${p}browse/rate_region.html",
+ ))
+%>
+
+<% include('/elements/error.html') %>
+
+
+%# rate plan info, if the region has been created yet
+
+% if($rate_region->regionnum) {
+
+
+Rates in this region
+<% include('/edit/elements/rate_detail.html',
+ 'regionnum' => $rate_region->regionnum,
+) %>
+% }
+
+<% include('/elements/footer.html') %>
+<%once>
+
+tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs();
+
+%once>
+<%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') ) {
@@ -8,8 +70,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 +80,16 @@ my $action = $rate_region->regionnum ? 'Edit' : 'Add';
my $p1 = popurl(1);
-my %granularity = (
- '6' => '6 second',
- '60' => 'minute',
-);
+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 ) {
- 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;
}
}
-%>
-
-<%= include("/elements/header.html","$action Region", menubar(
- 'Main Menu' => $p,
- #'View all regions' => "${p}browse/rate_region.cgi",
- ))
-%>
-
-<% if ( $cgi->param('error') ) { %>
-Error: <%= $cgi->param('error') %>
-<% } %>
-
-
-