svc_broadband merge
[freeside.git] / FS / FS / ac_type.pm
1 package FS::ac_type;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record qw( qsearchs );
6 use FS::ac;
7
8 @ISA = qw( FS::Record );
9
10 =head1 NAME
11
12 FS::ac_type - Object methods for ac_type records
13
14 =head1 SYNOPSIS
15
16   use FS::ac_type;
17
18   $record = new FS::ac_type \%hash;
19   $record = new FS::ac_type { 'column' => 'value' };
20
21   $error = $record->insert;
22
23   $error = $new_record->replace($old_record);
24
25   $error = $record->delete;
26
27   $error = $record->check;
28
29 =head1 DESCRIPTION
30
31 L<FS::ac_type> refers to a type of access concentrator.  L<FS::svc_broadband>
32 records refer to a specific L<FS::ac_type> limiting the choice of access
33 concentrator to one of the chosen type.  This should be set as a fixed
34 default in part_svc to prevent provisioning the wrong type of service for
35 a given package or service type.  Supported fields as follows:
36
37 =over 4
38
39 =item actypenum - Primary key.  see L<FS::ac>
40
41 =item actypename - Text identifier for access concentrator type.
42
43 =back
44
45 =head1 METHODS
46
47 =over 4
48
49 =item new HASHREF
50
51 Create a new record.  To add the record to the database, see L<"insert">.
52
53 =cut
54
55 sub table { 'ac_type'; }
56
57 =item insert
58
59 Adds this record to the database.  If there is an error, returns the error,
60 otherwise returns false.
61
62 =item delete
63
64 Deletes this record from the database.  If there is an error, returns the
65 error, otherwise returns false.
66
67 =item replace OLD_RECORD
68
69 Replaces OLD_RECORD with this one in the database.  If there is an error,
70 returns the error, otherwise returns false.
71
72 =item check
73
74 Checks all fields to make sure this is a valid record.  If there is an error,
75 returns the error, otherwise returns false.  Called by the insert and replace
76 methods.
77
78 =cut
79
80 sub check {
81   my $self = shift;
82
83   # What do we check?
84
85   ''; #no error
86 }
87
88 =item ac
89
90 Returns a list of all L<FS::ac> records of this type.
91
92 =cut
93
94 sub ac {
95   my $self = shift;
96
97   return qsearch('ac', { actypenum => $self->actypenum });
98 }
99
100 =item part_ac_field
101
102 Returns a list of all L<FS::part_ac_field> records of this type.
103
104 =cut
105
106 sub part_ac_field {
107   my $self = shift;
108
109   return qsearch('part_ac_field', { actypenum => $self->actypenum });
110 }
111
112 =back
113
114 =head1 VERSION
115
116 $Id: 
117
118 =head1 BUGS
119
120 =head1 SEE ALSO
121
122 L<FS::svc_broadband>, L<FS::ac>, L<FS::ac_block>, L<FS::ac_field>,  schema.html
123 from the base documentation.
124
125 =cut
126
127 1;
128