From: levinse Date: Thu, 23 Jun 2011 01:56:21 +0000 (+0000) Subject: add optional fcc_ds0s to pkg_class, RT13057 X-Git-Tag: freeside_2_1_3~93 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=4de19e4303d8d692fb772b0a332be325bab50db3 add optional fcc_ds0s to pkg_class, RT13057 --- diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index c08e4bba8..fb17f0bab 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -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' => [], diff --git a/FS/FS/pkg_class.pm b/FS/FS/pkg_class.pm index 51d0455a5..8132dd514 100644 --- a/FS/FS/pkg_class.pm +++ b/FS/FS/pkg_class.pm @@ -49,6 +49,8 @@ Number of associated pkg_category (see L) 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 diff --git a/httemplate/browse/pkg_class.html b/httemplate/browse/pkg_class.html index 97b0621ae..f3e236496 100644 --- a/httemplate/browse/pkg_class.html +++ b/httemplate/browse/pkg_class.html @@ -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.

'. @@ -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; diff --git a/httemplate/edit/elements/class_Common.html b/httemplate/edit/elements/class_Common.html index 2daf0e77f..23fe33d34 100644 --- a/httemplate/edit/elements/class_Common.html +++ b/httemplate/edit/elements/class_Common.html @@ -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'}; + diff --git a/httemplate/edit/pkg_class.html b/httemplate/edit/pkg_class.html index 4f7a729bd..1bc100e36 100644 --- a/httemplate/edit/pkg_class.html +++ b/httemplate/edit/pkg_class.html @@ -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' }; +} +