invoice voiding, RT#18677
[freeside.git] / FS / FS / cust_bill_pkg_void.pm
1 package FS::cust_bill_pkg_void;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record; # qw( qsearch qsearchs );
6
7 =head1 NAME
8
9 FS::cust_bill_pkg_void - Object methods for cust_bill_pkg_void records
10
11 =head1 SYNOPSIS
12
13   use FS::cust_bill_pkg_void;
14
15   $record = new FS::cust_bill_pkg_void \%hash;
16   $record = new FS::cust_bill_pkg_void { 'column' => 'value' };
17
18   $error = $record->insert;
19
20   $error = $new_record->replace($old_record);
21
22   $error = $record->delete;
23
24   $error = $record->check;
25
26 =head1 DESCRIPTION
27
28 An FS::cust_bill_pkg_void object represents a voided invoice line item.
29 FS::cust_bill_pkg_void inherits from FS::Record.  The following fields are
30 currently supported:
31
32 =over 4
33
34 =item billpkgnum
35
36 primary key
37
38 =item invnum
39
40 invnum
41
42 =item pkgnum
43
44 pkgnum
45
46 =item pkgpart_override
47
48 pkgpart_override
49
50 =item setup
51
52 setup
53
54 =item recur
55
56 recur
57
58 =item sdate
59
60 sdate
61
62 =item edate
63
64 edate
65
66 =item itemdesc
67
68 itemdesc
69
70 =item itemcomment
71
72 itemcomment
73
74 =item section
75
76 section
77
78 =item freq
79
80 freq
81
82 =item quantity
83
84 quantity
85
86 =item unitsetup
87
88 unitsetup
89
90 =item unitrecur
91
92 unitrecur
93
94 =item hidden
95
96 hidden
97
98
99 =back
100
101 =head1 METHODS
102
103 =over 4
104
105 =item new HASHREF
106
107 Creates a new record.  To add the record to the database, see L<"insert">.
108
109 Note that this stores the hash reference, not a distinct copy of the hash it
110 points to.  You can ask the object for a copy with the I<hash> method.
111
112 =cut
113
114 sub table { 'cust_bill_pkg_void'; }
115
116 =item insert
117
118 Adds this record to the database.  If there is an error, returns the error,
119 otherwise returns false.
120
121 =cut
122
123 =item delete
124
125 Delete this record from the database.
126
127 =cut
128
129 =item replace OLD_RECORD
130
131 Replaces the OLD_RECORD with this one in the database.  If there is an error,
132 returns the error, otherwise returns false.
133
134 =cut
135
136 =item check
137
138 Checks all fields to make sure this is a valid record.  If there is
139 an error, returns the error, otherwise returns false.  Called by the insert
140 and replace methods.
141
142 =cut
143
144 sub check {
145   my $self = shift;
146
147   my $error = 
148     $self->ut_number('billpkgnum')
149     || $self->ut_snumber('pkgnum')
150     || $self->ut_number('invnum') #cust_bill or cust_bill_void ?
151     || $self->ut_numbern('pkgpart_override')
152     || $self->ut_money('setup')
153     || $self->ut_money('recur')
154     || $self->ut_numbern('sdate')
155     || $self->ut_numbern('edate')
156     || $self->ut_textn('itemdesc')
157     || $self->ut_textn('itemcomment')
158     || $self->ut_textn('section')
159     || $self->ut_textn('freq')
160     || $self->ut_numbern('quantity')
161     || $self->ut_moneyn('unitsetup')
162     || $self->ut_moneyn('unitrecur')
163     || $self->ut_enum('hidden', [ '', 'Y' ])
164   ;
165   return $error if $error;
166
167   $self->SUPER::check;
168 }
169
170 =back
171
172 =head1 BUGS
173
174 =head1 SEE ALSO
175
176 L<FS::Record>, schema.html from the base documentation.
177
178 =cut
179
180 1;
181