eliminate some false laziness in FS::Misc::send_email vs. msg_template/email.pm send_...
[freeside.git] / FS / FS / cust_bill_pkg_detail_void.pm
1 package FS::cust_bill_pkg_detail_void;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record; # qw( qsearch qsearchs );
6 use FS::cust_bill_pkg_void;
7 use FS::usage_class;
8
9 =head1 NAME
10
11 FS::cust_bill_pkg_detail_void - Object methods for cust_bill_pkg_detail_void records
12
13 =head1 SYNOPSIS
14
15   use FS::cust_bill_pkg_detail_void;
16
17   $record = new FS::cust_bill_pkg_detail_void \%hash;
18   $record = new FS::cust_bill_pkg_detail_void { '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_bill_pkg_detail_void object represents additional detail
31 information for a voided invoice line item.  FS::cust_bill_pkg_detail_void
32 inherits from FS::Record.  The following fields are currently supported:
33
34 =over 4
35
36 =item detailnum
37
38 primary key
39
40 =item billpkgnum
41
42 billpkgnum
43
44 =item pkgnum
45
46 pkgnum
47
48 =item invnum
49
50 invnum
51
52 =item amount
53
54 amount
55
56 =item format
57
58 format
59
60 =item classnum
61
62 classnum
63
64 =item duration
65
66 duration
67
68 =item phonenum
69
70 phonenum
71
72 =item accountcode
73
74 accountcode
75
76 =item startdate
77
78 startdate
79
80 =item regionname
81
82 regionname
83
84 =item detail
85
86 detail
87
88
89 =back
90
91 =head1 METHODS
92
93 =over 4
94
95 =item new HASHREF
96
97 Creates a new record.  To add the record to the database, see L<"insert">.
98
99 Note that this stores the hash reference, not a distinct copy of the hash it
100 points to.  You can ask the object for a copy with the I<hash> method.
101
102 =cut
103
104 sub table { 'cust_bill_pkg_detail_void'; }
105
106 =item insert
107
108 Adds this record to the database.  If there is an error, returns the error,
109 otherwise returns false.
110
111 =cut
112
113 =item delete
114
115 Delete this record from the database.
116
117 =cut
118
119 =item replace OLD_RECORD
120
121 Replaces the OLD_RECORD with this one in the database.  If there is an error,
122 returns the error, otherwise returns false.
123
124 =cut
125
126 =item check
127
128 Checks all fields to make sure this is a valid record.  If there is
129 an error, returns the error, otherwise returns false.  Called by the insert
130 and replace methods.
131
132 =cut
133
134 sub check {
135   my $self = shift;
136
137   my $error = 
138     $self->ut_number('detailnum')
139     || $self->ut_foreign_keyn('billpkgnum', 'cust_bill_pkg_void', 'billpkgnum')
140     || $self->ut_numbern('pkgnum')
141     || $self->ut_numbern('invnum')
142     || $self->ut_floatn('amount')
143     || $self->ut_enum('format', [ '', 'C' ] )
144     || $self->ut_foreign_keyn('classnum', 'usage_class', 'classnum')
145     || $self->ut_numbern('duration')
146     || $self->ut_textn('phonenum')
147     || $self->ut_textn('accountcode')
148     || $self->ut_numbern('startdate')
149     || $self->ut_textn('regionname')
150     || $self->ut_text('detail')
151   ;
152   return $error if $error;
153
154   $self->SUPER::check;
155 }
156
157 =back
158
159 =head1 BUGS
160
161 =head1 SEE ALSO
162
163 L<FS::Record>, schema.html from the base documentation.
164
165 =cut
166
167 1;
168