4 use vars qw( @ISA $conf $DEBUG $me );
5 use FS::Record qw( qsearch qsearchs );
11 @ISA = qw( FS::svc_Common );
13 $me = '[FS::svc_dsl]';
15 FS::UID->install_callback( sub {
22 FS::svc_dsl - Object methods for svc_dsl records
28 $record = new FS::svc_dsl \%hash;
29 $record = new FS::svc_dsl { 'column' => 'value' };
31 $error = $record->insert;
33 $error = $new_record->replace($old_record);
35 $error = $record->delete;
37 $error = $record->check;
39 $error = $record->suspend;
41 $error = $record->unsuspend;
43 $error = $record->cancel;
47 An FS::svc_dsl object represents a DSL service. FS::svc_dsl inherits from
48 FS::svc_Common. The following fields are currently supported:
52 =item svcnum - Primary key (assigned automatcially for new DSL))
54 =item pushed - Time DSL order pushed to vendor/telco, if applicable
56 =item desired_due_date - Desired Due Date
58 =item due_date - Due Date
60 =item vendor_order_id - Vendor/telco DSL order #
62 =item vendor_order_type
64 Vendor/telco DSL order type (e.g. (M)ove, (A)dd, (C)hange, (D)elete, or similar)
66 =item vendor_order_status
68 Vendor/telco DSL order status (e.g. (N)ew, (A)ssigned, (R)ejected, (M)revised,
69 (C)ompleted, (X)cancelled, or similar)
71 =item first - End-user first name
73 =item last - End-user last name
75 =item company - End-user company name
77 =item phonenum - DSL Telephone Number
79 =item gateway_access_number - Gateway access number, if different
81 =item loop_type - Loop-type - vendor/telco-specific
83 =item local_voice_provider - Local Voice Provider's name
85 =item circuitnum - Circuit #
91 =item rate_band - Rate Band
101 Ikano-specific fields, do not use otherwise
103 =item username - if outsourced PPPoE/RADIUS, username
105 =item password - if outsourced PPPoE/RADIUS, password
107 =item monitored - Order is monitored (auto-pull/sync), either Y or blank
109 =item last_pull - time of last data pull from vendor/telco
120 Creates a new DSL. To add the DSL to the database, see L<"insert">.
122 Note that this stores the hash reference, not a distinct copy of the hash it
123 points to. You can ask the object for a copy with the I<hash> method.
127 # the new method can be inherited from FS::Record, if a table method is defined
130 my %dis1 = ( disable_default=>1, disable_fixed=>1, disable_inventory=>1, disable_select=>1 );
131 my %dis2 = ( disable_inventory=>1, disable_select=>1 );
135 'name_plural' => 'DSLs',
136 'lcname_plural' => 'DSLs',
137 'sorts' => [ 'phonenum' ],
138 'display_weight' => 55,
139 'cancel_weight' => 75,
141 'pushed' => { label => 'Pushed',
142 type => 'disabled' },
143 'desired_due_date' => { label => 'Desired Due Date', %dis2, },
144 'due_date' => { label => 'Due Date', %dis2, },
145 'vendor_order_id' => { label => 'Vendor Order ID', %dis2, },
146 'vendor_qual_id' => { label => 'Vendor Qualification ID',
147 type => 'disabled' },
148 'vendor_order_type' => { label => 'Vendor Order Type',
149 disable_inventory => 1, },
150 'vendor_order_status' => { label => 'Vendor Order Status',
151 disable_inventory => 1, },
152 'first' => { label => 'First Name', %dis2, },
153 'last' => { label => 'Last Name', %dis2, },
154 'company' => { label => 'Company Name', %dis2, },
155 'phonenum' => { label => 'Service Telephone Number', },
156 'gateway_access_number' => { label => 'Gateway Access Number'.
157 ' (if different)', },
158 'loop_type' => { label => 'Loop Type',
159 disable_inventory => 1, },
160 'local_voice_provider' => { label => 'Local Voice Provider',
161 disable_inventory => 1, },
162 'circuitnum' => { label => 'Circuit #', },
163 'rate_band' => { label => 'Rate Band',
164 disable_inventory => 1, },
165 'vpi' => { label => 'VPI',
166 disable_inventory => 1 },
167 'vci' => { label => 'VCI',
168 disable_inventory => 1 },
169 'isp_chg' => { label => 'ISP Changing?',
172 'isp_prev' => { label => 'Current or Previous ISP',
173 disable_inventory => 1, },
174 'username' => { label => 'PPPoE Username',
176 'password' => { label => 'PPPoE Password', %dis2 },
177 'staticips' => { label => 'Static IPs', %dis1 },
178 'monitored' => { label => 'Monitored',
179 type => 'checkbox', %dis2 },
180 'last_pull' => { label => 'Last Pull',
181 type => 'disabled' },
186 sub table { 'svc_dsl'; }
190 return $self->phonenum if $self->phonenum;
191 return $self->username if $self->username;
192 return $self->vendor_order_id if $self->vendor_order_id;
193 return $self->svcnum;
198 Returns the set of FS::dsl_notes associated with this service
203 qsearch( 'dsl_note', { 'svcnum' => $self->svcnum } );
208 Adds this record to the database. If there is an error, returns the error,
209 otherwise returns false.
213 # the insert method can be inherited from FS::Record
217 Delete this record from the database.
221 # the delete method can be inherited from FS::Record
223 =item replace OLD_RECORD
225 Replaces the OLD_RECORD with this one in the database. If there is an error,
226 returns the error, otherwise returns false.
230 # the replace method can be inherited from FS::Record
234 Checks all fields to make sure this is a valid DSL. If there is
235 an error, returns the error, otherwise returns false. Called by the insert
240 # the check method should currently be supplied - FS::Record contains some
241 # data checking routines
247 $self->ut_numbern('svcnum')
248 || $self->ut_numbern('pushed')
249 || $self->ut_numbern('desired_due_date')
250 || $self->ut_numbern('due_date')
251 || $self->ut_textn('vendor_order_id')
252 || $self->ut_textn('vendor_qual_id')
253 || $self->ut_alphan('vendor_order_type')
254 || $self->ut_alphan('vendor_order_status')
255 || $self->ut_textn('first')
256 || $self->ut_textn('last')
257 || $self->ut_textn('company')
258 || $self->ut_numbern('phonenum')
259 || $self->ut_numbern('gateway_access_number')
260 || $self->ut_alphasn('loop_type')
261 || $self->ut_textn('local_voice_provider')
262 || $self->ut_textn('circuitnum')
263 || $self->ut_textn('rate_band')
264 || $self->ut_numbern('vpi')
265 || $self->ut_numbern('vci')
266 || $self->ut_alphan('isp_chg')
267 || $self->ut_textn('isp_prev')
268 || $self->ut_textn('username')
269 || $self->ut_textn('password')
270 || $self->ut_textn('staticips')
271 || $self->ut_enum('monitored', [ '', 'Y' ])
272 || $self->ut_numbern('last_pull')
274 return $error if $error;
276 $self->gateway_access_number('')
277 if $self->phonenum && $self->phonenum eq $self->gateway_access_number;
282 =item gateway_access_or_phonenum
286 sub gateway_access_or_phonenum {
288 $self->gateway_access_number || $self->phonenum;
293 Returns the MAC addresses associated with this DSL service, as FS::dsl_device
300 qsearch('dsl_device', { 'svcnum' => $self->svcnum });
303 sub predelete_hook_first {
305 my @exports = $self->part_svc->part_export_dsl_pull;
306 return 'More than one DSL-pulling export attached' if scalar(@exports) > 1;
307 if ( scalar(@exports) == 1 ) {
308 my $export = $exports[0];
309 return $export->dsl_pull($self);
316 my @notes = $self->notes;
317 foreach my $note ( @notes ) {
318 my $error = $note->delete;
319 return $error if $error;
328 L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface,
329 export.html from the base documentation, L<FS::Record>, L<FS::Conf>,
330 L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>,
331 L<freeside-queued>, schema.html from the base documentation.