[freeside-commits] freeside/httemplate/edit/process rate_region.cgi, 1.2, 1.3
Ivan,,,
ivan at wavetail.420.am
Thu Jan 10 13:53:52 PST 2008
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail:/tmp/cvs-serv4007/httemplate/edit/process
Modified Files:
rate_region.cgi
Log Message:
new rate editor
Index: rate_region.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/rate_region.cgi,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rate_region.cgi 23 Aug 2006 22:25:37 -0000 1.2
+++ rate_region.cgi 10 Jan 2008 21:53:49 -0000 1.3
@@ -1,52 +1,53 @@
-%
-%
-%my $regionnum = $cgi->param('regionnum');
-%
-%my $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum;
-%
-%my $new = new FS::rate_region ( {
-% map {
-% $_, scalar($cgi->param($_));
-% } ( fields('rate_region') )
-%} );
-%
-%my $countrycode = $cgi->param('countrycode');
-%my @npa = split(/\s*,\s*/, $cgi->param('npa'));
-%$npa[0] = '' unless @npa;
-%my @rate_prefix = map {
-% new FS::rate_prefix {
-% 'countrycode' => $countrycode,
-% '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', {} );
-%
-%
-%my $error;
-%if ( $regionnum ) {
-% $error = $new->replace($old, 'rate_prefix' => \@rate_prefix,
-% 'dest_detail' => \@dest_detail, );
-%} else {
-% $error = $new->insert( 'rate_prefix' => \@rate_prefix,
-% 'dest_detail' => \@dest_detail, );
-% $regionnum = $new->getfield('regionnum');
-%}
-%
%if ( $error ) {
% $cgi->param('error', $error);
-% print $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string );
+<% $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");
+<% $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 $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum;
+
+my $new = new FS::rate_region ( {
+ map {
+ $_, scalar($cgi->param($_));
+ } ( fields('rate_region') )
+} );
+my $countrycode = $cgi->param('countrycode');
+my @npa = split(/\s*,\s*/, $cgi->param('npa'));
+$npa[0] = '' unless @npa;
+my @rate_prefix = map {
+ new FS::rate_prefix {
+ 'countrycode' => $countrycode,
+ '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', {} );
+
+
+my $error;
+if ( $regionnum ) {
+ $error = $new->replace($old, 'rate_prefix' => \@rate_prefix,
+ 'dest_detail' => \@dest_detail, );
+} else {
+ $error = $new->insert( 'rate_prefix' => \@rate_prefix,
+ 'dest_detail' => \@dest_detail, );
+ $regionnum = $new->getfield('regionnum');
+}
+
+</%init>
More information about the freeside-commits
mailing list