add optional fcc_ds0s to pkg_class, RT13057
authorlevinse <levinse>
Thu, 23 Jun 2011 01:56:21 +0000 (01:56 +0000)
committerlevinse <levinse>
Thu, 23 Jun 2011 01:56:21 +0000 (01:56 +0000)
FS/FS/Schema.pm
FS/FS/pkg_class.pm
httemplate/browse/pkg_class.html
httemplate/edit/elements/class_Common.html
httemplate/edit/pkg_class.html

index c08e4bb..fb17f0b 100644 (file)
@@ -2508,6 +2508,7 @@ sub tables_hashref {
         'classname',   'varchar',  '', $char_d, '', '', 
         'categorynum', 'int',  'NULL',      '', '', '', 
         'disabled',    'char', 'NULL',       1, '', '', 
+        'fcc_ds0s',      'int',     'NULL', '', '', '', 
       ],
       'primary_key' => 'classnum',
       'unique' => [],
index 51d0455..8132dd5 100644 (file)
@@ -49,6 +49,8 @@ Number of associated pkg_category (see L<FS::pkg_category>)
 
 Disabled flag, empty or 'Y'
 
+=item fcc_ds0s - Optional DS0 equivalency number for FCC form 477
+
 =back
 
 =head1 METHODS
@@ -65,6 +67,16 @@ L<"insert">.
 sub table { 'pkg_class'; }
 sub _target_table { 'part_pkg'; }
 
+sub check {
+    my $self = shift;
+    my $error = $self->ut_numbern('fcc_ds0s')
+        || $self->SUPER::check
+    ;
+    return $error if $error;
+
+    '';
+}
+
 =item insert
 
 Adds this package class to the database.  If there is an error, returns the
index 97b0621..f3e2364 100644 (file)
@@ -19,6 +19,8 @@
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
+my $conf = new FS::Conf;
+
 my $html_init = 
   'Package classes define groups of packages, for taxation, ordering '.
   'convenience and reporting.<BR><BR>'.
@@ -32,6 +34,12 @@ my $header = [ '#', 'Class' ];
 my $fields = [ 'classnum', 'classname' ];
 my $links  = [ $link, $link ];
 
+if($conf->exists('cust_main-require_censustract')) {
+    push @{$fields}, 'fcc_ds0s';
+    push @{$header}, 'FCC form 477 voice-grade equivalents';
+    push @{$links}, '';
+}
+
 my $cat_query = 'SELECT COUNT(*) FROM pkg_class where categorynum IS NOT NULL';
 my $sth = dbh->prepare($cat_query)
   or die "Error preparing $cat_query: ". dbh->errstr;
index 2daf0e7..23fe33d 100644 (file)
@@ -1,17 +1,11 @@
 <% include( 'edit.html',
-              'fields' => [
-                            'classname',
-                            (scalar(@category)
-                              ? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>'pkg_category', 'name_col'=>'categoryname' }
-                              : { field=>'categorynum', type=>'hidden' }
-                            ),
-                            { field=>'disabled', type=>'checkbox', value=>'Y', },
-                          ],
+              'fields' => $fields,
               'labels' => { 
                             'classnum'    => 'Class number',
                             'classname'   => 'Class name',
                             'categorynum' => 'Category',
                             'disabled'    => 'Disable class',
+                            %addl_labels,
                           },
               'viewall_dir' => 'browse',
               %opt,
@@ -33,4 +27,16 @@ unless ( $opt{'nocat'} ) {
     @category = qsearch($category_table, { 'disabled' => '' });
 }
 
+my $fields = [   'classname',
+        (scalar(@category)
+          ? { field=>'categorynum', type=>'select-table', 'empty_label'=>'(none)', 'table'=>'pkg_category', 'name_col'=>'categoryname' }
+          : { field=>'categorynum', type=>'hidden' }
+        ),
+        { field=>'disabled', type=>'checkbox', value=>'Y', },
+        ];
+push @$fields, $opt{'addl_fields'} if $opt{'addl_fields'};
+
+my %addl_labels = ();
+%addl_labels = %{$opt{'addl_labels'}} if $opt{'addl_labels'};
+
 </%init>
index 4f7a729..1bc100e 100644 (file)
@@ -1,5 +1,16 @@
 <% include( 'elements/class_Common.html',
               'name'   => 'Package Class',
               'table'  => 'pkg_class',
+              %opt,
           )
 %>
+<%init>
+
+my $conf = new FS::Conf;
+
+my %opt = ();
+if($conf->exists('cust_main-require_censustract')) {
+ $opt{'addl_fields'} = qw( fcc_ds0s );
+ $opt{'addl_labels'} = { 'fcc_ds0s' => 'FCC form 477 voice-grade equivalents' };
+}
+</%init>