4 use vars qw( @ISA $conf $DEBUG $me );
5 use FS::Record qw( qsearch qsearchs );
10 @ISA = qw( FS::svc_Common );
12 $me = '[FS::svc_dsl]';
14 FS::UID->install_callback( sub {
21 FS::svc_dsl - Object methods for svc_dsl records
27 $record = new FS::svc_dsl \%hash;
28 $record = new FS::svc_dsl { 'column' => 'value' };
30 $error = $record->insert;
32 $error = $new_record->replace($old_record);
34 $error = $record->delete;
36 $error = $record->check;
38 $error = $record->suspend;
40 $error = $record->unsuspend;
42 $error = $record->cancel;
46 An FS::svc_dsl object represents a DSL service. FS::svc_dsl inherits from
47 FS::svc_Common. The following fields are currently supported:
51 =item svcnum - Primary key (assigned automatcially for new DSL))
53 =item pushed - Time DSL order pushed to vendor/telco, if applicable
55 =item desired_due_date - Desired Due Date
57 =item due_date - Due Date
59 =item vendor_order_id - Vendor/telco DSL order #
61 =item vendor_order_type
63 Vendor/telco DSL order type (e.g. (M)ove, (A)dd, (C)hange, (D)elete, or similar)
65 =item vendor_order_status
67 Vendor/telco DSL order status (e.g. (N)ew, (A)ssigned, (R)ejected, (M)revised,
68 (C)ompleted, (X)cancelled, or similar)
70 =item first - End-user first name
72 =item last - End-user last name
74 =item company - End-user company name
76 =item phonenum - DSL Telephone Number
78 =item loop_type - Loop-type - vendor/telco-specific
80 =item local_voice_provider - Local Voice Provider's name
82 =item circuitnum - Circuit #
88 =item rate_band - Rate Band
98 Ikano-specific fields, do not use otherwise
100 =item username - if outsourced PPPoE/RADIUS, username
102 =item password - if outsourced PPPoE/RADIUS, password
104 =item monitored - Order is monitored (auto-pull/sync), either Y or blank
106 =item last_pull - time of last data pull from vendor/telco
117 Creates a new DSL. To add the DSL to the database, see L<"insert">.
119 Note that this stores the hash reference, not a distinct copy of the hash it
120 points to. You can ask the object for a copy with the I<hash> method.
124 # the new method can be inherited from FS::Record, if a table method is defined
127 my %dis1 = ( disable_default=>1, disable_fixed=>1, disable_inventory=>1, disable_select=>1 );
128 my %dis2 = ( disable_inventory=>1, disable_select=>1 );
132 'name_plural' => 'DSLs',
133 'lcname_plural' => 'DSLs',
134 'sorts' => [ 'phonenum' ],
135 'display_weight' => 55,
136 'cancel_weight' => 75,
138 'pushed' => { label => 'Pushed',
139 type => 'disabled' },
140 'desired_due_date' => { label => 'Desired Due Date', %dis2, },
141 'due_date' => { label => 'Due Date', %dis2, },
142 'vendor_order_id' => { label => 'Vendor Order Id', %dis2, },
143 'vendor_qual_id' => { label => 'Vendor Qualification Id',
144 type => 'disabled' },
145 'vendor_order_type' => { label => 'Vendor Order Type',
146 disable_inventory => 1,
148 'vendor_order_status' => { label => 'Vendor Order Status',
149 disable_inventory => 1,
151 'first' => { label => 'First Name', %dis2, },
152 'last' => { label => 'Last Name', %dis2, },
153 'company' => { label => 'Company Name', %dis2, },
154 'phonenum' => { label => 'Service Telephone Number', },
155 'loop_type' => { label => 'Loop Type',
156 disable_inventory => 1,
158 'local_voice_provider' => { label => 'Local Voice Provider',
159 disable_inventory => 1,
161 'circuitnum' => { label => 'Circuit #', },
162 'rate_band' => { label => 'Rate Band',
163 disable_inventory => 1,
165 'vpi' => { label => 'VPI', disable_inventory => 1 },
166 'vci' => { label => 'VCI', disable_inventory => 1 },
167 'isp_chg' => { label => 'ISP Changing?',
168 type => 'checkbox', %dis2 },
169 'isp_prev' => { label => 'Current or Previous ISP',
170 disable_inventory => 1,
172 'username' => { label => 'PPPoE Username',
175 'password' => { label => 'PPPoE Password', %dis2 },
176 'staticips' => { label => 'Static IPs', %dis1 },
177 'monitored' => { label => 'Monitored',
178 type => 'checkbox', %dis2 },
179 'last_pull' => { label => 'Last Pull', type => 'disabled' },
184 sub table { 'svc_dsl'; }
188 return $self->phonenum if $self->phonenum;
189 return $self->username if $self->username;
190 return $self->vendor_order_id if $self->vendor_order_id;
191 return $self->svcnum;
196 Returns the set of FS::dsl_notes associated with this service
201 qsearch( 'dsl_note', { 'svcnum' => $self->svcnum } );
206 Adds this record to the database. If there is an error, returns the error,
207 otherwise returns false.
211 # the insert method can be inherited from FS::Record
215 Delete this record from the database.
219 # the delete method can be inherited from FS::Record
221 =item replace OLD_RECORD
223 Replaces the OLD_RECORD with this one in the database. If there is an error,
224 returns the error, otherwise returns false.
228 # the replace method can be inherited from FS::Record
232 Checks all fields to make sure this is a valid DSL. If there is
233 an error, returns the error, otherwise returns false. Called by the insert
238 # the check method should currently be supplied - FS::Record contains some
239 # data checking routines
245 $self->ut_numbern('svcnum')
246 || $self->ut_numbern('pushed')
247 || $self->ut_numbern('desired_due_date')
248 || $self->ut_numbern('due_date')
249 || $self->ut_textn('vendor_order_id')
250 || $self->ut_textn('vendor_qual_id')
251 || $self->ut_alphan('vendor_order_type')
252 || $self->ut_alphan('vendor_order_status')
253 || $self->ut_textn('first')
254 || $self->ut_textn('last')
255 || $self->ut_textn('company')
256 || $self->ut_numbern('phonenum')
257 || $self->ut_alphasn('loop_type')
258 || $self->ut_textn('local_voice_provider')
259 || $self->ut_textn('circuitnum')
260 || $self->ut_textn('rate_band')
261 || $self->ut_numbern('vpi')
262 || $self->ut_numbern('vci')
263 || $self->ut_alphan('isp_chg')
264 || $self->ut_textn('isp_prev')
265 || $self->ut_textn('username')
266 || $self->ut_textn('password')
267 || $self->ut_textn('staticips')
268 || $self->ut_enum('monitored', [ '', 'Y' ])
269 || $self->ut_numbern('last_pull')
271 return $error if $error;
276 sub predelete_hook_first {
278 my @exports = $self->part_svc->part_export_dsl_pull;
279 return 'More than one DSL-pulling export attached' if scalar(@exports) > 1;
280 if ( scalar(@exports) == 1 ) {
281 my $export = $exports[0];
282 return $export->dsl_pull($self);
289 my @notes = $self->notes;
290 foreach my $note ( @notes ) {
291 my $error = $note->delete;
292 return $error if $error;
301 L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface,
302 export.html from the base documentation, L<FS::Record>, L<FS::Conf>,
303 L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>,
304 L<freeside-queued>, schema.html from the base documentation.