enable CardFortress in test database, #71513
[freeside.git] / FS / FS / part_pkg_fcc_option.pm
1 package FS::part_pkg_fcc_option;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6 use Storable qw(dclone);
7 use Tie::IxHash;
8
9 sub table { 'part_pkg_fcc_option'; }
10
11 =head1 NAME
12
13 FS::part_pkg_fcc_option - Object methods for part_pkg_fcc_option records
14
15 =head1 SYNOPSIS
16
17   use FS::part_pkg_fcc_option;
18
19   $record = new FS::part_pkg_fcc_option \%hash;
20   $record = new FS::part_pkg_fcc_option { 'column' => 'value' };
21
22   $error = $record->insert;
23
24   $error = $new_record->replace($old_record);
25
26   $error = $record->delete;
27
28   $error = $record->check;
29
30 =head1 DESCRIPTION
31
32 An FS::part_pkg_fcc_option object represents an option that classifies a
33 package definition on the FCC Form 477 report.  FS::part_pkg_fcc_option 
34 inherits from FS::Record.  The following fields are currently supported:
35
36 =over 4
37
38 =item num
39
40 primary key
41
42 =item fccoptionname
43
44 A string identifying a report option, as an element of a static data
45 structure found within this module.  See the C<part> method.
46
47 =item pkgpart
48
49 L<FS::part_pkg> foreign key.
50
51 =item optionvalue
52
53 The value of the report option, as an integer.  Boolean options use 1 
54 and NULL.  Most other options have some kind of lookup table.
55
56 =back
57
58 =head1 METHODS
59
60 =over 4
61
62 =item check
63
64 Checks all fields to make sure this is a valid FCC option.  If there is
65 an error, returns the error, otherwise returns false.  Called by the insert
66 and replace methods.
67
68 =cut
69
70 sub check {
71   my $self = shift;
72
73   my $error = 
74     $self->ut_numbern('num')
75     || $self->ut_alpha('fccoptionname')
76     || $self->ut_number('pkgpart')
77     || $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart')
78     || $self->ut_textn('optionvalue')
79   ;
80   return $error if $error;
81
82   $self->SUPER::check;
83 }
84
85 =back
86
87 =head1 CLASS METHODS
88
89 =over 4
90
91 =item media_types
92
93 Returns a Tie::IxHash hashref of the media type strings (which are not 
94 part of the report definition, per se) to arrayrefs of the technology 
95 codes included in each one.
96
97 =item technology_labels
98
99 Returns a hashref relating each technology code to a label.  Unlike the 
100 media type strings, the technology codes are part of the formal report
101 definition.
102
103 =cut
104
105 tie our %media_types, 'Tie::IxHash', (
106   'Copper'          => [ 11, 12, 10, 20, 30 ],
107   'Cable Modem'     => [ 41, 42, 40 ],
108   'Fiber'           => [ 50 ],
109   'Satellite'       => [ 60 ],
110   'Fixed Wireless'  => [ 70 ],
111   'Mobile Wireless' => [ 80, 81, 82, 83, 84, 85, 86, 87, 88 ],
112   'Other'           => [ 90, 0 ],
113 );
114
115 tie our %technology_labels, 'Tie::IxHash',  (
116   10 => 'Other ADSL',
117   11 => 'ADSL2',
118   12 => 'VDSL',
119   20 => 'SDSL',
120   30 => 'Other Copper Wireline',
121   40 => 'Other Cable Modem',
122   41 => 'Cable - DOCSIS 1, 1.1, 2.0',
123   42 => 'Cable - DOCSIS 3.0',
124   50 => 'Fiber',
125   60 => 'Satellite',
126   70 => 'Terrestrial Fixed Wireless',
127   # mobile wireless
128   80 => 'Mobile - WCDMA/UMTS/HSPA',
129   81 => 'Mobile - HSPA+',
130   82 => 'Mobile - EVDO/EVDO Rev A',
131   83 => 'Mobile - LTE',
132   84 => 'Mobile - WiMAX',
133   85 => 'Mobile - CDMA',
134   86 => 'Mobile - GSM',
135   87 => 'Mobile - Analog',
136   88 => 'Other Mobile',
137
138   90 => 'Electric Power Line',
139   0  => 'Other'
140 );
141
142 tie our %spectrum_labels, 'Tie::IxHash', (
143   90 => '700 MHz Band',
144   91 => 'Cellular Band',
145   92 => 'Specialized Mobile Radio (SMR) Band',
146   93 => 'Advanced Wireless Services (AWS) 1 Band',
147   94 => 'Broadband Personal Communications Service (PCS) Band',
148   95 => 'Wireless Communications Service (WCS) Band',
149   96 => 'Broadband Radio Service/Educational Broadband Service Band',
150   97 => 'Satellite (e.g. L-band, Big LEO, Little LEO)',
151   98 => 'Unlicensed (including broadcast television "white spaces") Bands',
152   99 => '600 MHz',
153   100 => 'H Block',
154   101 => 'Advanced Wireless Services (AWS) 3 Band',
155   102 => 'Advanced Wireless Services (AWS) 4 Band',
156   103 => 'Other',
157 );
158
159 sub media_types {
160   Storable::dclone(\%media_types);
161 }
162
163 sub technology_labels {
164   Storable::dclone(\%technology_labels);
165 }
166
167 sub spectrum_labels {
168   Storable::dclone(\%spectrum_labels);
169 }
170
171 =head1 BUGS
172
173 =head1 SEE ALSO
174
175 L<FS::Record>, schema.html from the base documentation.
176
177 =cut
178
179 1;
180