<% 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 = < <%= include("/elements/header.html","$action Rate plan", menubar( 'Main Menu' => $p, 'View all rate plans' => "${p}browse/rate.cgi", )) %> <%= include('/elements/progress-init.html', 'OneTrueForm', [ 'rate', 'min_', 'sec_' ], 'process/rate.cgi', $p.'browse/rate.cgi', ) %>
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({ 'select' => 'DISTINCT ON ( regionnum ) rate_region.*', 'table' => 'rate_region', 'hashref' => {}, #'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 }) ) { 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' }; %> <%= $rate_region->regionname %> <%= $rate_region->prefixes_short %> min_included %>"> $min_charge ) %>"> <% } %> Add a region
" onClick="document.OneTrueForm.submit.disabled=true; process();">