1 <% include('elements/edit.html',
4 'table' => 'rate_detail',
5 'labels' => { 'ratedetailnum' => 'Rate', #should hide...
6 'dest_regionname' => 'Region',
7 'dest_prefixes_short' => 'Prefix(es)',
8 'min_included' => 'Included minutes/calls',
9 'conn_charge' => 'Connection charge',
11 'min_charge' => 'Charge per minute/call',
12 'sec_granularity' => 'Granularity',
13 'classnum' => 'Usage class',
16 { field=>'ratenum', type=>'hidden', },
17 { field=>'orig_regionnum', type=>'hidden', },
18 { field=>'dest_regionnum', type=>'hidden', },
19 { field=>'dest_regionname', type=>'fixed', },
20 { field=>'dest_prefixes_short', type=>'fixed', },
21 { field=>'min_included', type=>'text', size=>5 },
22 { field=>'conn_charge', type=>'money', size=>4 },
25 options => [ keys %conn_secs ],
26 labels => \%conn_secs,
29 { field=>'min_charge', type=>'money', size=>4 },
30 { field =>'sec_granularity',
32 options => [ keys %granularity ],
33 labels => \%granularity,
37 type =>'select-table',
38 table =>'usage_class',
39 name_col =>'classname',
40 empty_label =>'(default)',
41 hashref =>{ disabled => '' },
49 tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
50 tie my %conn_secs, 'Tie::IxHash', FS::rate_detail::conn_secs();
55 my $conf = new FS::Conf;
57 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
59 #slightly inefficient, i suppose an edit+error callback would be better
61 my ($keywords) = $cgi->keywords;
62 if ( $keywords =~ /^(\d+)$/
63 || $cgi->param('ratedetailnum') =~ /^(\d+)$/ ) {
64 my $rate_detail = qsearchs('rate_detail', { 'ratedetailnum' => $1 } )
65 or die "unknown ratedetailnum $1";
67 $rate_detail->rate->ratename. ' rate for '. $rate_detail->dest_regionname;
70 #sec_granularity should default to 60! for new rates when this gets used for em