connection fee for initial N seconds support, RT#7018
[freeside.git] / httemplate / edit / rate_detail.html
index b9eaf65..869ace8 100644 (file)
@@ -5,9 +5,12 @@
      'labels' => { 'ratedetailnum'       => 'Rate', #should hide...
                    'dest_regionname'     => 'Region',
                    'dest_prefixes_short' => 'Prefix(es)',
-                   'min_included'        => 'Included minutes',
-                   'min_charge'          => 'Charge per minute',
+                   'min_included'        => 'Included minutes/calls',
+                   'conn_charge'         => 'Connection charge',
+                   'conn_sec'            => 'For',
+                   'min_charge'          => 'Charge per minute/call',
                    'sec_granularity'     => 'Granularity',
+                   'classnum'            => 'Usage class',
                  },
      'fields' => [
                    { field=>'ratenum',             type=>'hidden', },
                    { field=>'dest_regionname',     type=>'fixed',  },
                    { field=>'dest_prefixes_short', type=>'fixed',  },
                    { field=>'min_included',        type=>'text',  size=>5 },
+                   { field=>'conn_charge',         type=>'money', size=>4 },
+                   { field          =>'conn_sec',
+                      type          =>'select',
+                      options       => [ keys %conn_secs ],
+                      labels        => \%conn_secs,
+                      disable_empty => 1,
+                   },
                    { field=>'min_charge',          type=>'money', size=>4 },
                    { field         =>'sec_granularity',
                      type          =>'select',
-                     options       => [qw( 1 6 30 60 )],
+                     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',
-  '1', => '1 second',
-  '6'  => '6 second',
-  '30' => '30 second', # '1/2 minute',
-  '60' => 'minute',
-;
+tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
+tie my %conn_secs,   'Tie::IxHash', FS::rate_detail::conn_secs();
 
 </%once>
-
 <%init>
 
 my $conf = new FS::Conf;
@@ -46,7 +58,8 @@ die "access denied"
 
 #slightly inefficient, i suppose an edit+error callback would be better
 my $name = 'rate';
-if (    $cgi->keywords               =~ /^(\d+)$/
+my ($keywords) = $cgi->keywords;
+if (    $keywords                    =~ /^(\d+)$/
      || $cgi->param('ratedetailnum') =~ /^(\d+)$/ ) {
   my $rate_detail = qsearchs('rate_detail', { 'ratedetailnum' => $1 } )
     or die "unknown ratedetailnum $1";