X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Frate.cgi;h=1abfb0d321bffff13c1a887323ec845c3683e655;hp=c44364da966166cfd1bb700cba150014314868f3;hb=75e11f1d1a5ced24496b5732e290f7762403feb8;hpb=eaad412e5e8b33958f7331ae4449786fb567230e diff --git a/httemplate/edit/rate.cgi b/httemplate/edit/rate.cgi index c44364da9..1abfb0d32 100644 --- a/httemplate/edit/rate.cgi +++ b/httemplate/edit/rate.cgi @@ -1,43 +1,11 @@ -% -% -%my $rate; -%if ( $cgi->keywords ) { -% my($query) = $cgi->keywords; -% $query =~ /^(\d+)$/; -% $rate = qsearchs( 'rate', { 'ratenum' => $1 } ); -%} else { #adding -% $rate = new FS::rate {}; -%} -%my $action = $rate->ratenum ? 'Edit' : 'Add'; -% -%my $p1 = popurl(1); -% -%my %granularity = ( -% '1', => '1 second', -% '6' => '6 second', -% '30' => '30 second', # '1/2 minute', -% '60' => 'minute', -%); -% -%#my $nous = < $p, 'View all rate plans' => "${p}browse/rate.cgi", )) %> <% include('/elements/progress-init.html', 'OneTrueForm', - [ 'rate', 'min_', 'sec_' ], + [ 'rate', 'preserve_rate_detail' ], # 'rate', 'min_', 'sec_' ], 'process/rate.cgi', $p.'browse/rate.cgi', ) @@ -49,72 +17,59 @@ Rate plan

-<% table() %> - - Region - Prefix(es) - Included
minutes
- Charge per
minute
- Granularity - -% foreach my $rate_region ( -% #sort { lc($a->regionname) cmp lc($b->regionname) } -% qsearch({ -% 'table' => 'rate_region', -% 'hashref' => {}, -% 'order_by' => 'ORDER BY LOWER(regionname)', -% -% #'select' => 'DISTINCT ON ( regionnum ) rate_region.*', -% #... -% #'addl_from' => 'INNER JOIN rate_prefix USING ( regionnum )', -% #'extra_sql' => "WHERE countrycode != '1'", -% -% # 'ORDER BY regionname' -% # ERROR: SELECT DISTINCT ON expressions must -% # match initial ORDER BY expressions -% # also, DISTINCT ON is a Pg-ism -% }) -% ) { -% my $n = $rate_region->regionnum; -% my $rate_detail = -% $rate->dest_detail($rate_region) -% || new FS::rate_detail { 'min_included' => 0, -% 'min_charge' => 0, -% 'sec_granularity' => '60' -% }; -% + +" onClick="document.OneTrueForm.submit.disabled=true; process();"> + - - <% $rate_region->regionname %> - <% $rate_region->prefixes_short %> - min_included %>"> - $min_charge ) %>"> - - + +Usage type: <% $select_cdr_type %> + +% } - - -% } +<% include('/edit/elements/rate_detail.html', + 'ratenum' => $rate->ratenum, + 'countrycode' => $countrycode, + 'cdrtypenum' => $cdrtypenum, +) %> +% } +<% include('/elements/footer.html') %> - - - Add a region - - +<%init> - +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); -
" onClick="document.OneTrueForm.submit.disabled=true; process();"> +my $rate; +if ( $cgi->param('ratenum') ) { + $cgi->param('ratenum') =~ /^(\d+)$/; + $rate = qsearchs( 'rate', { 'ratenum' => $1 } ); +} else { #adding + $rate = new FS::rate {}; +} +my $action = $rate->ratenum ? 'Edit' : 'Add'; - - - +my $countrycode = ''; +if ( $cgi->param('countrycode') =~ /^(\d+)$/ ) { + $countrycode = $1; +} +my $cdrtypenum = ''; +if ( $cgi->param('cdrtypenum') =~ /^(\d+)$/ ) { + $cdrtypenum = $1; +} +