communigate provisioning phase 2: Domain:Account Defaults:Settings: RulesAllowed...
[freeside.git] / FS / FS / cust_class.pm
1 package FS::cust_class;
2
3 use strict;
4 use base qw( FS::class_Common );
5 use FS::cust_main;
6 use FS::cust_category;
7
8 =head1 NAME
9
10 FS::cust_class - Object methods for cust_class records
11
12 =head1 SYNOPSIS
13
14   use FS::cust_class;
15
16   $record = new FS::cust_class \%hash;
17   $record = new FS::cust_class { 'column' => 'value' };
18
19   $error = $record->insert;
20
21   $error = $new_record->replace($old_record);
22
23   $error = $record->delete;
24
25   $error = $record->check;
26
27 =head1 DESCRIPTION
28
29 An FS::pkg_class object represents an customer class.  Every customer (see
30 L<FS::cust_main>) has, optionally, a customer class. FS::cust_class inherits
31 from FS::Record.  The following fields are currently supported:
32
33 =over 4
34
35 =item classnum
36
37 primary key
38
39 =item classname
40
41 Text name of this customer class
42
43 =item categorynum
44
45 Number of associated cust_category (see L<FS::cust_category>)
46
47 =item disabled
48
49 Disabled flag, empty or 'Y'
50
51 =back
52
53 =head1 METHODS
54
55 =over 4
56
57 =item new HASHREF
58
59 Creates a new customer class.  To add the customer class to the database, see
60 L<"insert">.
61
62 =cut
63
64 sub table { 'cust_class'; }
65 sub _target_table { 'cust_main'; }
66
67 =item insert
68
69 Adds this customer class to the database.  If there is an error, returns the
70 error, otherwise returns false.
71
72 =item delete
73
74 Delete this customer class from the database.  Only customer classes with no
75 associated customers can be deleted.  If there is an error, returns
76 the error, otherwise returns false.
77
78 =item replace [ OLD_RECORD ]
79
80 Replaces OLD_RECORD with this one in the database.  If there is an error,
81 returns the error, otherwise returns false.
82
83 =item check
84
85 Checks all fields to make sure this is a valid customer class.  If there is
86 an error, returns the error, otherwise returns false.  Called by the insert
87 and replace methods.
88
89 =item cust_category
90
91 =item category
92
93 Returns the cust_category record associated with this class, or false if there
94 is none.
95
96 =cut
97
98 sub cust_category {
99   my $self = shift;
100   $self->category;
101 }
102
103 =item categoryname
104
105 Returns the category name associated with this class, or false if there
106 is none.
107
108 =cut
109
110 =back
111
112 =head1 BUGS
113
114 =head1 SEE ALSO
115
116 L<FS::cust_main>, L<FS::Record>
117
118 =cut
119
120 1;