initial commit of svc_dsl, qual, and qual_option - schema and new modules which do...
[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
50
51 Primary key (assigned automatcially for new DSL))
52
53 =item pushed
54
55 Time the DSL order was pushed to a vendor, if exporting orders to a vendor/telco
56
57 =item desired_dd
58
59 Desired Due Date
60
61 =item dd
62
63 Due Date (e.g. once order is in Assigned status or similar by the telco)
64
65 =item vendor_order_id
66
67 Vendor/telco DSL order #
68
69 =item vendor_order_type
70
71 Vendor/telco DSL order type (e.g. (M)ove, (A)dd, (C)hange, (D)elete, or similar)
72
73 =item vendor_order_status
74
75 Vendor/telco DSL order status (e.g. (N)ew, (A)ssigned, (R)ejected, (M)revised,
76 (C)ompleted, (X)cancelled, or similar)
77
78 =item first
79
80 End-user first name
81
82 =item last
83
84 End-user last name
85
86 =item company
87
88 End-user company name
89
90 =item svctn
91
92 DSL Telephone Number
93
94 =item loop_type
95
96 Loop-type - vendor/telco-specific
97
98 =item lvp
99
100 Local Voice Provider's name
101
102 =item cktnum
103
104 Circuit #
105
106 =item rate_band
107
108 Rate Band
109
110 =item isp_chg
111
112 =item isp_prev
113
114 =item staticips
115
116 =item vendor_qual_id
117
118 Ikano-specific fields, do not use otherwise
119
120 =item username
121
122 If outsourced PPPoE/RADIUS, username
123
124 =item password
125
126 If outsourced PPPoE/RADIUS, password
127
128 =item monitored
129
130 Order is monitored (auto-pull/sync), either Y or blank
131
132 =item last_pull
133
134 Time of last data pull from vendor/telco
135
136 =item notes
137
138 DSL order notes placed by staff or vendor/telco on the vendor/telco order
139
140
141 =back
142
143 =head1 METHODS
144
145 =over 4
146
147 =item new HASHREF
148
149 Creates a new DSL.  To add the DSL to the database, see L<"insert">.
150
151 Note that this stores the hash reference, not a distinct copy of the hash it
152 points to.  You can ask the object for a copy with the I<hash> method.
153
154 =cut
155
156 # the new method can be inherited from FS::Record, if a table method is defined
157
158 sub table { 'svc_dsl'; }
159
160 =item insert
161
162 Adds this record to the database.  If there is an error, returns the error,
163 otherwise returns false.
164
165 =cut
166
167 # the insert method can be inherited from FS::Record
168
169 =item delete
170
171 Delete this record from the database.
172
173 =cut
174
175 # the delete method can be inherited from FS::Record
176
177 =item replace OLD_RECORD
178
179 Replaces the OLD_RECORD with this one in the database.  If there is an error,
180 returns the error, otherwise returns false.
181
182 =cut
183
184 # the replace method can be inherited from FS::Record
185
186 =item check
187
188 Checks all fields to make sure this is a valid DSL.  If there is
189 an error, returns the error, otherwise returns false.  Called by the insert
190 and replace methods.
191
192 =cut
193
194 # the check method should currently be supplied - FS::Record contains some
195 # data checking routines
196
197 sub check {
198   my $self = shift;
199
200   my $error = 
201     $self->ut_numbern('svcnum')
202     || $self->ut_numbern('pushed')
203     || $self->ut_number('desired_dd')
204     || $self->ut_numbern('dd')
205     || $self->ut_textn('vendor_order_id')
206     || $self->ut_textn('vendor_qual_id')
207     || $self->ut_alpha('vendor_order_type')
208     || $self->ut_alphan('vendor_order_status')
209     || $self->ut_text('first')
210     || $self->ut_text('last')
211     || $self->ut_textn('company')
212     || $self->ut_numbern('svctn')
213     || $self->ut_alphasn('loop_type')
214     || $self->ut_textn('lvp')
215     || $self->ut_textn('cktnum')
216     || $self->ut_textn('rate_band')
217     || $self->ut_alphan('isp_chg')
218     || $self->ut_textn('isp_prev')
219     || $self->ut_textn('username')
220     || $self->ut_textn('password')
221     || $self->ut_textn('staticips')
222     || $self->ut_enum('monitored',    [ '', 'Y' ])
223     || $self->ut_numbern('last_pull')
224     || $self->ut_textn('notes')
225   ;
226   return $error if $error;
227
228   $self->SUPER::check;
229 }
230
231 =back
232
233 =head1 BUGS
234
235 This doesn't do anything yet.
236
237 =head1 SEE ALSO
238
239 L<FS::svc_Common>, edit/part_svc.cgi from an installed web interface,
240 export.html from the base documentation, L<FS::Record>, L<FS::Conf>,
241 L<FS::cust_svc>, L<FS::part_svc>, L<FS::cust_pkg>, L<FS::queue>,
242 L<freeside-queued>, schema.html from the base documentation.
243
244 =cut
245
246 1;
247