communigate provisioning phase 2: add svc_domain.trailer -> communigate TrailerText...
[freeside.git] / FS / FS / cust_pkg_detail.pm
1 package FS::cust_pkg_detail;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record; # qw( qsearch qsearchs );
6
7 @ISA = qw(FS::Record);
8
9 =head1 NAME
10
11 FS::cust_pkg_detail - Object methods for cust_pkg_detail records
12
13 =head1 SYNOPSIS
14
15   use FS::cust_pkg_detail;
16
17   $record = new FS::cust_pkg_detail \%hash;
18   $record = new FS::cust_pkg_detail { '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::cust_pkg_detail object represents additional customer package details.
31 FS::cust_pkg_detail inherits from FS::Record.  The following fields are
32 currently supported:
33
34 =over 4
35
36 =item pkgdetailnum
37
38 primary key
39
40 =item pkgnum
41
42 pkgnum (see L<FS::cust_pkg>)
43
44 =item detail
45
46 detail
47
48 =item detailtype
49
50 "I" for Invoice details or "C" for comments
51
52 =item weight
53
54 Optional display weight
55
56 =back
57
58 =head1 METHODS
59
60 =over 4
61
62 =item new HASHREF
63
64 Creates a new record.  To add the record to the database, see L<"insert">.
65
66 Note that this stores the hash reference, not a distinct copy of the hash it
67 points to.  You can ask the object for a copy with the I<hash> method.
68
69 =cut
70
71 # the new method can be inherited from FS::Record, if a table method is defined
72
73 sub table { 'cust_pkg_detail'; }
74
75 =item insert
76
77 Adds this record to the database.  If there is an error, returns the error,
78 otherwise returns false.
79
80 =cut
81
82 # the insert method can be inherited from FS::Record
83
84 =item delete
85
86 Delete this record from the database.
87
88 =cut
89
90 # the delete method can be inherited from FS::Record
91
92 =item replace OLD_RECORD
93
94 Replaces the OLD_RECORD with this one in the database.  If there is an error,
95 returns the error, otherwise returns false.
96
97 =cut
98
99 # the replace method can be inherited from FS::Record
100
101 =item check
102
103 Checks all fields to make sure this is a valid record.  If there is
104 an error, returns the error, otherwise returns false.  Called by the insert
105 and replace methods.
106
107 =cut
108
109 # the check method should currently be supplied - FS::Record contains some
110 # data checking routines
111
112 sub check {
113   my $self = shift;
114
115   my $error = 
116     $self->ut_numbern('pkgdetailnum')
117     || $self->ut_foreign_key('pkgnum', 'cust_pkg', 'pkgnum')
118     || $self->ut_text('detail')
119     || $self->ut_enum('detailtype', [ 'I', 'C' ] )
120     || $self->ut_numbern('weight')
121   ;
122   return $error if $error;
123
124   $self->weight(0) unless $self->weight;
125
126   $self->SUPER::check;
127 }
128
129 =back
130
131 =head1 BUGS
132
133 =head1 SEE ALSO
134
135 L<FS::cust_pkg>, L<FS::Record>, schema.html from the base documentation.
136
137 =cut
138
139 1;
140