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 'sorts' => [ 'phonenum' ],
133 'display_weight' => 55,
134 'cancel_weight' => 75,
136 'pushed' => { label => 'Pushed',
137 type => 'disabled' },
138 'desired_due_date' => { label => 'Desired Due Date', %dis2, },
139 'due_date' => { label => 'Due Date', %dis2, },
140 'vendor_order_id' => { label => 'Vendor Order Id', %dis2, },
141 'vendor_qual_id' => { label => 'Vendor Qualification Id',
142 type => 'disabled' },
143 'vendor_order_type' => { label => 'Vendor Order Type',
144 disable_inventory => 1,
146 'vendor_order_status' => { label => 'Vendor Order Status',
147 disable_inventory => 1,
149 'first' => { label => 'First Name', %dis2, },
150 'last' => { label => 'Last Name', %dis2, },
151 'company' => { label => 'Company Name', %dis2, },
152 'phonenum' => { label => 'Service Telephone Number', },
153 'loop_type' => { label => 'Loop Type',
154 disable_inventory => 1,
156 'local_voice_provider' => { label => 'Local Voice Provider',
157 disable_inventory => 1,
159 'circuitnum' => { label => 'Circuit #', },
160 'rate_band' => { label => 'Rate Band',
161 disable_inventory => 1,
163 'vpi' => { label => 'VPI', disable_inventory => 1 },
164 'vci' => { label => 'VCI', disable_inventory => 1 },
165 'isp_chg' => { label => 'ISP Changing?',
166 type => 'checkbox', %dis2 },
167 'isp_prev' => { label => 'Current or Previous ISP',
168 disable_inventory => 1,
170 'username' => { label => 'PPPoE Username',
173 'password' => { label => 'PPPoE Password', %dis2 },
174 'staticips' => { label => 'Static IPs', %dis1 },
175 'monitored' => { label => 'Monitored',
176 type => 'checkbox', %dis2 },
177 'last_pull' => { label => 'Last Pull', type => 'disabled' },
182 sub table { 'svc_dsl'; }
186 return $self->phonenum if $self->phonenum;
187 return $self->username if $self->username;
188 return $self->vendor_order_id if $self->vendor_order_id;
189 return $self->svcnum;
194 Returns the set of FS::dsl_notes associated with this service
199 qsearch( 'dsl_note', { 'svcnum' => $self->svcnum } );
204 Adds this record to the database. If there is an error, returns the error,
205 otherwise returns false.
209 # the insert method can be inherited from FS::Record
213 Delete this record from the database.
217 # the delete method can be inherited from FS::Record
219 =item replace OLD_RECORD
221 Replaces the OLD_RECORD with this one in the database. If there is an error,
222 returns the error, otherwise returns false.
226 # the replace method can be inherited from FS::Record
230 Checks all fields to make sure this is a valid DSL. If there is
231 an error, returns the error, otherwise returns false. Called by the insert
236 # the check method should currently be supplied - FS::Record contains some
237 # data checking routines
243 $self->ut_numbern('svcnum')
244 || $self->ut_numbern('pushed')
245 || $self->ut_numbern('desired_due_date')
246 || $self->ut_numbern('due_date')
247 || $self->ut_textn('vendor_order_id')
248 || $self->ut_textn('vendor_qual_id')
249 || $self->ut_alphan('vendor_order_type')
250 || $self->ut_alphan('vendor_order_status')
251 || $self->ut_text('first')
252 || $self->ut_text('last')
253 || $self->ut_textn('company')
254 || $self->ut_numbern('phonenum')
255 || $self->ut_alphasn('loop_type')
256 || $self->ut_textn('local_voice_provider')
257 || $self->ut_textn('circuitnum')
258 || $self->ut_textn('rate_band')
259 || $self->ut_numbern('vpi')
260 || $self->ut_numbern('vci')
261 || $self->ut_alphan('isp_chg')
262 || $self->ut_textn('isp_prev')
263 || $self->ut_textn('username')
264 || $self->ut_textn('password')
265 || $self->ut_textn('staticips')
266 || $self->ut_enum('monitored', [ '', 'Y' ])
267 || $self->ut_numbern('last_pull')
269 return $error if $error;
274 sub predelete_hook_first {
276 my @exports = $self->part_svc->part_export_dsl_pull;
277 return 'More than one DSL-pulling export attached' if scalar(@exports) > 1;
278 if ( scalar(@exports) == 1 ) {
279 my $export = $exports[0];
280 return $export->dsl_pull($self);
287 my @notes = $self->notes;
288 foreach my $note ( @notes ) {
289 my $error = $note->delete;
290 return $error if $error;
299 L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface,
300 export.html from the base documentation, L<FS::Record>, L<FS::Conf>,
301 L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>,
302 L<freeside-queued>, schema.html from the base documentation.