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