summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevinse <levinse>2011-06-23 01:55:51 +0000
committerlevinse <levinse>2011-06-23 01:55:51 +0000
commit3545cf7c664f5cd24a5c4e9cf8c7ef368ac51f1f (patch)
tree48b2b3895869dcb6d4dd41d4b587934ed7722dcd
parent1070837a51a12ce1e46242dfdff99daa7b96da61 (diff)
add optional fcc_ds0s to pkg_class, RT13057
-rw-r--r--FS/FS/Schema.pm1
-rw-r--r--FS/FS/pkg_class.pm12
-rw-r--r--httemplate/browse/pkg_class.html8
-rw-r--r--httemplate/edit/elements/class_Common.html22
-rw-r--r--httemplate/edit/pkg_class.html11
5 files changed, 46 insertions, 8 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index ae0541331..bf84f0b2b 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -2780,6 +2780,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<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
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.<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;
diff --git a/httemplate/edit/elements/class_Common.html b/httemplate/edit/elements/class_Common.html
index e6334fe23..69da4db31 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'};
+
</%init>
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' };
+}
+</%init>