% include('elements/edit.html',
'popup' => 1,
'name' => $name,
'table' => 'rate_detail',
'labels' => { 'ratedetailnum' => 'Rate', #should hide...
'dest_regionname' => 'Region',
'dest_prefixes_short' => 'Prefix(es)',
'min_included' => 'Included minutes/calls',
'min_charge' => 'Charge per minute/call',
'sec_granularity' => 'Granularity',
'classnum' => 'Usage class',
},
'fields' => [
{ field=>'ratenum', type=>'hidden', },
{ field=>'orig_regionnum', type=>'hidden', },
{ field=>'dest_regionnum', type=>'hidden', },
{ field=>'dest_regionname', type=>'fixed', },
{ field=>'dest_prefixes_short', type=>'fixed', },
{ field=>'min_included', type=>'text', size=>5 },
{ field=>'min_charge', type=>'money', size=>4 },
{ field =>'sec_granularity',
type =>'select',
options => [ keys %granularity ],
labels => \%granularity,
disable_empty => 1,
},
{ field =>'classnum',
type =>'select-table',
table =>'usage_class',
name_col =>'classname',
empty_label =>'(default)',
hashref =>{ disabled => '' },
},
],
)
%>
<%once>
tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
%once>
<%init>
my $conf = new FS::Conf;
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
#slightly inefficient, i suppose an edit+error callback would be better
my $name = 'rate';
my ($keywords) = $cgi->keywords;
if ( $keywords =~ /^(\d+)$/
|| $cgi->param('ratedetailnum') =~ /^(\d+)$/ ) {
my $rate_detail = qsearchs('rate_detail', { 'ratedetailnum' => $1 } )
or die "unknown ratedetailnum $1";
$name =
$rate_detail->rate->ratename. ' rate for '. $rate_detail->dest_regionname;
}
#sec_granularity should default to 60! for new rates when this gets used for em
%init>