X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Frate_region.cgi;h=d342e605a9e154146fd2def8051c5b78f5bf0a71;hb=e50b6ec8d63afe4c04ae33384758d8786fcc7cfe;hp=09d3d2c420ea4037d380db671927a3722daaa6a3;hpb=673b9a458d9138523026963df6fa3b4683e09bae;p=freeside.git diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index 09d3d2c42..d342e605a 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -1,6 +1,19 @@ -<% +%if ( $error ) { +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string ) %> +%} elsif ( $action eq 'Add' ) { +<% $cgi->redirect(popurl(2). "rate_region.cgi?$regionnum") %> +%} else { +<% $cgi->redirect(popurl(3). "browse/rate_region.html") %> +%} +<%init> + +my $conf = new FS::Conf; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $regionnum = $cgi->param('regionnum'); +my $action = $regionnum ? 'Edit' : 'Add'; my $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum; @@ -14,38 +27,22 @@ my $countrycode = $cgi->param('countrycode'); my @npa = split(/\s*,\s*/, $cgi->param('npa')); $npa[0] = '' unless @npa; my @rate_prefix = map { + #my($npa,$nxx) = split('-', $_); + s/\D//g; new FS::rate_prefix { 'countrycode' => $countrycode, + #'npa' => $npa, + #'nxx' => $nxx, 'npa' => $_, } } @npa; - -my @dest_detail = map { - my $ratenum = $_->ratenum; - new FS::rate_detail { - 'ratenum' => $ratenum, - map { $_ => $cgi->param("$_$ratenum") } - qw( min_included min_charge sec_granularity ) - }; -} qsearch('rate', {} ); - - +# we no longer process dest_detail records here my $error; if ( $regionnum ) { - $error = $new->replace($old, 'rate_prefix' => \@rate_prefix, - 'dest_detail' => \@dest_detail, ); + $error = $new->replace($old, 'rate_prefix' => \@rate_prefix ); } else { - $error = $new->insert( 'rate_prefix' => \@rate_prefix, - 'dest_detail' => \@dest_detail, ); + $error = $new->insert( 'rate_prefix' => \@rate_prefix ); $regionnum = $new->getfield('regionnum'); } -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string ); -} else { - #print $cgi->redirect(popurl(3). "browse/rate_region.cgi"); - print $cgi->redirect(popurl(3). "browse/rate.cgi"); -} - -%> +