ikano, svc_dsl, qual, on-going implementation, RT7111
[freeside.git] / FS / FS / svc_dsl.pm
1 package FS::svc_dsl;
2
3 use strict;
4 use vars qw( @ISA $conf $DEBUG $me );
5 use FS::Record qw( qsearch qsearchs );
6 use FS::svc_Common;
7
8 @ISA = qw( FS::svc_Common );
9 $DEBUG = 0;
10 $me = '[FS::svc_dsl]';
11
12 FS::UID->install_callback( sub { 
13   $conf = new FS::Conf;
14 }
15 );
16
17 =head1 NAME
18
19 FS::svc_dsl - Object methods for svc_dsl records
20
21 =head1 SYNOPSIS
22
23   use FS::svc_dsl;
24
25   $record = new FS::svc_dsl \%hash;
26   $record = new FS::svc_dsl { 'column' => 'value' };
27
28   $error = $record->insert;
29
30   $error = $new_record->replace($old_record);
31
32   $error = $record->delete;
33
34   $error = $record->check;
35   
36   $error = $record->suspend;
37
38   $error = $record->unsuspend;
39
40   $error = $record->cancel;
41
42 =head1 DESCRIPTION
43
44 An FS::svc_dsl object represents a DSL service.  FS::svc_dsl inherits from
45 FS::svc_Common.  The following fields are currently supported:
46
47 =over 4
48
49 =item svcnum - Primary key (assigned automatcially for new DSL))
50
51 =item pushed - Time DSL order pushed to vendor/telco, if applicable
52
53 =item desired_due_date - Desired Due Date
54
55 =item due_date - Due Date
56
57 =item vendor_order_id - Vendor/telco DSL order #
58
59 =item vendor_order_type
60
61 Vendor/telco DSL order type (e.g. (M)ove, (A)dd, (C)hange, (D)elete, or similar)
62
63 =item vendor_order_status
64
65 Vendor/telco DSL order status (e.g. (N)ew, (A)ssigned, (R)ejected, (M)revised,
66 (C)ompleted, (X)cancelled, or similar)
67
68 =item first - End-user first name
69
70 =item last - End-user last name
71
72 =item company - End-user company name
73
74 =item phonenum - DSL Telephone Number
75
76 =item loop_type - Loop-type - vendor/telco-specific
77
78 =item local_voice_provider - Local Voice Provider's name
79
80 =item circuitnum - Circuit #
81
82 =item rate_band - Rate Band
83
84 =item isp_chg
85
86 =item isp_prev
87
88 =item staticips
89
90 =item vendor_qual_id
91
92 Ikano-specific fields, do not use otherwise
93
94 =item username - if outsourced PPPoE/RADIUS, username
95
96 =item password - if outsourced PPPoE/RADIUS, password
97
98 =item monitored - Order is monitored (auto-pull/sync), either Y or blank
99
100 =item last_pull - time of last data pull from vendor/telco
101
102 =item notes
103
104 DSL order notes placed by staff or vendor/telco on the vendor/telco order
105
106
107 =back
108
109 =head1 METHODS
110
111 =over 4
112
113 =item new HASHREF
114
115 Creates a new DSL.  To add the DSL to the database, see L<"insert">.
116
117 Note that this stores the hash reference, not a distinct copy of the hash it
118 points to.  You can ask the object for a copy with the I<hash> method.
119
120 =cut
121
122 # the new method can be inherited from FS::Record, if a table method is defined
123
124 sub table_info {
125     my %dis1 = ( disable_default=>1, disable_fixed=>1, disable_inventory=>1, disable_select=>1 );
126     my %dis2 = ( disable_inventory=>1, disable_select=>1 );
127
128     {
129         'name' => 'DSL',
130         'sorts' => [ 'phonenum' ],
131         'display_weight' => 55,
132         'cancel_weight' => 75,
133         'fields' => {
134             'pushed' => {       label => 'Pushed', 
135                                 type => 'disabled' },
136             'desired_due_date' => {     label => 'Desired Due Date', %dis2, },
137             'due_date' => {             label => 'Due Date', %dis2, },
138             'vendor_order_id' => { label => 'Vendor Order Id', %dis2, },
139             'vendor_qual_id' => { label => 'Vendor Qualification Id', 
140                                 type => 'disabled' },
141             'vendor_order_type' => { label => 'Vendor Order Type',
142                                     disable_inventory => 1,
143                                 },
144             'vendor_order_status' => { label => 'Vendor Order Status',
145                                     disable_inventory => 1,
146                                     },
147             'first' => {        label => 'First Name', %dis2, },
148             'last' => {         label => 'Last Name', %dis2, },
149             'company' => {      label => 'Company Name', %dis2, },
150             'phonenum' => {     label => 'Service Telephone Number', },
151             'loop_type' => {    label => 'Loop Type',
152                                     disable_inventory => 1,
153                         },
154             'local_voice_provider' => {         label => 'Local Voice Provider',
155                                     disable_inventory => 1,
156                         },
157             'circuitnum' => {   label => 'Circuit #',   },
158             'rate_band' => {    label => 'Rate Band',
159                                     disable_inventory => 1,
160                         },
161             'isp_chg' => {      label => 'ISP Changing?', 
162                                 type => 'checkbox', %dis2 },
163             'isp_prev' => {     label => 'Current or Previous ISP',
164                                     disable_inventory => 1,
165                         },
166             'username' => {     label => 'PPPoE Username',
167                                 type => 'text',
168                         },
169             'password' => {     label => 'PPPoE Password', %dis2 },
170             'staticips' => {    label => 'Static IPs', %dis1 },
171             'monitored' => {    label => 'Monitored', 
172                                 type => 'checkbox', %dis2 },
173             'last_pull' => {    label => 'Last Pull', type => 'disabled' },
174             'notes' => {        label => 'Order Notes', %dis1 },
175         },
176     };
177 }
178
179 sub table { 'svc_dsl'; }
180
181 sub label {
182    my $self = shift;
183    return $self->phonenum if $self->phonenum;
184    return $self->username if $self->username;
185    return $self->vendor_order_id if $self->vendor_order_id;
186    return $self->svcnum;
187 }
188
189 =item insert
190
191 Adds this record to the database.  If there is an error, returns the error,
192 otherwise returns false.
193
194 =cut
195
196 # the insert method can be inherited from FS::Record
197
198 =item delete
199
200 Delete this record from the database.
201
202 =cut
203
204 # the delete method can be inherited from FS::Record
205
206 =item replace OLD_RECORD
207
208 Replaces the OLD_RECORD with this one in the database.  If there is an error,
209 returns the error, otherwise returns false.
210
211 =cut
212
213 # the replace method can be inherited from FS::Record
214
215 =item check
216
217 Checks all fields to make sure this is a valid DSL.  If there is
218 an error, returns the error, otherwise returns false.  Called by the insert
219 and replace methods.
220
221 =cut
222
223 # the check method should currently be supplied - FS::Record contains some
224 # data checking routines
225
226 sub check {
227   my $self = shift;
228
229   my $error = 
230     $self->ut_numbern('svcnum')
231     || $self->ut_numbern('pushed')
232     || $self->ut_number('desired_due_date')
233     || $self->ut_numbern('due_date')
234     || $self->ut_textn('vendor_order_id')
235     || $self->ut_textn('vendor_qual_id')
236     || $self->ut_alpha('vendor_order_type')
237     || $self->ut_alphan('vendor_order_status')
238     || $self->ut_text('first')
239     || $self->ut_text('last')
240     || $self->ut_textn('company')
241     || $self->ut_numbern('phonenum')
242     || $self->ut_alphasn('loop_type')
243     || $self->ut_textn('local_voice_provider')
244     || $self->ut_textn('circuitnum')
245     || $self->ut_textn('rate_band')
246     || $self->ut_alphan('isp_chg')
247     || $self->ut_textn('isp_prev')
248     || $self->ut_textn('username')
249     || $self->ut_textn('password')
250     || $self->ut_textn('staticips')
251     || $self->ut_enum('monitored',    [ '', 'Y' ])
252     || $self->ut_numbern('last_pull')
253     || $self->ut_textn('notes')
254   ;
255   return $error if $error;
256
257   $self->SUPER::check;
258 }
259
260 =back
261
262 =head1 SEE ALSO
263
264 L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface,
265 export.html from the base documentation, L<FS::Record>, L<FS::Conf>,
266 L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>,
267 L<freeside-queued>, schema.html from the base documentation.
268
269 =cut
270
271 1;
272