1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
package FS::svc_circuit;
use strict;
use base qw(
FS::svc_IP_Mixin
FS::MAC_Mixin
FS::svc_Common
);
use FS::Record qw( qsearch qsearchs );
use FS::circuit_provider;
use FS::circuit_type;
use FS::circuit_termination;
=head1 NAME
FS::svc_circuit - Object methods for svc_circuit records
=head1 SYNOPSIS
use FS::svc_circuit;
$record = new FS::svc_circuit \%hash;
$record = new FS::svc_circuit { 'column' => 'value' };
$error = $record->insert;
$error = $new_record->replace($old_record);
$error = $record->delete;
$error = $record->check;
=head1 DESCRIPTION
An FS::svc_circuit object represents a telecom circuit service (other than
an analog phone line, which is svc_phone, or a DSL Internet connection,
which is svc_dsl). FS::svc_circuit inherits from FS::svc_IP_Mixin,
FS::MAC_Mixin, and FS::svc_Common. The following fields are currently
supported:
=over 4
=item svcnum - primary key; see also L<FS::cust_svc>
=item typenum - circuit type (such as DS1, DS1-PRI, DS3, OC3, etc.); foreign
key to L<FS::circuit_type>.
=item providernum - circuit provider (telco); foreign key to
L<FS::circuit_provider>.
=item termnum - circuit termination type; foreign key to
L<FS::circuit_termination>
=item circuit_id - circuit ID string defined by the provider
=item desired_due_date - the requested date for completion of the circuit
order
=item due_date - the provider's committed date for completion of the circuit
order
=item vendor_order_id - the provider's order number
=item vendor_qual_id - the qualification number, if a qualification was
performed
=item vendor_order_type -
=item vendor_order_status - the order status: ACCEPTED, PENDING, COMPLETED,
etc.
=item endpoint_ip_addr - the IP address of the endpoint equipment, if any.
This will be validated as an IP address but not assigned from managed address
space or checked for uniqueness.
=item endpoint_mac_addr - the MAC address of the endpoint.
=back
=head1 METHODS
=over 4
=item new HASHREF
Creates a new circuit service. To add the record to the database, see
L<"insert">.
=cut
sub table { 'svc_circuit'; }
sub table_info {
my %dis = ( disable_default => 1, disable_fixed => 1,
disabled_inventory => 1, disable_select => 1 );
tie my %fields, 'Tie::IxHash', (
'svcnum' => 'Service',
'providernum' => {
label => 'Provider',
type => 'select',
select_table => 'circuit_provider',
select_key => 'providernum',
select_label => 'provider',
disable_inventory => 1,
},
'typenum' => {
label => 'Circuit type',
type => 'select',
select_table => 'circuit_type',
select_key => 'typenum',
select_label => 'typename',
disable_inventory => 1,
},
'termnum' => {
label => 'Termination type',
type => 'select',
select_table => 'circuit_termination',
select_key => 'termnum',
select_label => 'termination',
disable_inventory => 1,
},
'circuit_id' => { label => 'Circuit ID', %dis },
'desired_due_date' => { label => 'Desired due date',
%dis
},
'due_date' => { label => 'Due date',
%dis
},
'vendor_order_id' => { label => 'Vendor order ID', %dis },
'vendor_qual_id' => { label => 'Vendor qualification ID', %dis },
'vendor_order_type' => {
label => 'Vendor order type',
disable_inventory => 1
}, # should be a select?
'vendor_order_status' => {
label => 'Vendor order status',
disable_inventory => 1
}, # should also be a select?
'endpoint_ip_addr' => {
label => 'Endpoint IP address',
},
'endpoint_mac_addr' => {
label => 'Endpoint MAC address',
type => 'input-mac_addr',
disable_inventory => 1,
},
);
return {
'name' => 'Circuit',
'name_plural' => 'Circuits',
'longname_plural' => 'Voice and data circuit services',
'display_weight' => 72,
'cancel_weight' => 85, # after svc_phone
'fields' => \%fields,
};
}
=item insert
Adds this record to the database. If there is an error, returns the error,
otherwise returns false.
=item delete
Delete this record from the database.
=item replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error,
returns the error, otherwise returns false.
=item check
Checks all fields to make sure this is a valid service. If there is
an error, returns the error, otherwise returns false. Called by the insert
and replace methods.
=cut
sub check {
my $self = shift;
my $mac_addr = uc($self->get('endpoint_mac_addr'));
$mac_addr =~ s/[\W_]//g;
$self->set('endpoint_mac_addr', $mac_addr);
my $error =
$self->ut_numbern('svcnum')
|| $self->ut_number('typenum')
|| $self->ut_number('providernum')
|| $self->ut_text('circuit_id')
|| $self->ut_numbern('desired_due_date')
|| $self->ut_numbern('due_date')
|| $self->ut_textn('vendor_order_id')
|| $self->ut_textn('vendor_qual_id')
|| $self->ut_textn('vendor_order_type')
|| $self->ut_textn('vendor_order_status')
|| $self->ut_ipn('endpoint_ip_addr')
|| $self->ut_textn('endpoint_mac_addr')
;
# no canonical values yet for vendor_order_status or _type
return $error if $error;
$self->SUPER::check;
}
=item label
Returns the circuit ID.
=cut
sub label {
my $self = shift;
$self->get('circuit_id');
}
=back
=head1 SEE ALSO
L<FS::Record>
=cut
1;
|