'classname', 'varchar', '', $char_d, '', '',
'categorynum', 'int', 'NULL', '', '', '',
'disabled', 'char', 'NULL', 1, '', '',
+ 'fcc_ds0s', 'int', 'NULL', '', '', '',
],
'primary_key' => 'classnum',
'unique' => [],
Disabled flag, empty or 'Y'
+=item fcc_ds0s - Optional DS0 equivalency number for FCC form 477
+
=back
=head1 METHODS
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
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>'.
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;
<% 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,
@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>
<% 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>