default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / FS / FS / cust_tax_exempt_pkg_void.pm
1 package FS::cust_tax_exempt_pkg_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::cust_main_county;
8
9 =head1 NAME
10
11 FS::cust_tax_exempt_pkg_void - Object methods for cust_tax_exempt_pkg_void records
12
13 =head1 SYNOPSIS
14
15   use FS::cust_tax_exempt_pkg_void;
16
17   $record = new FS::cust_tax_exempt_pkg_void \%hash;
18   $record = new FS::cust_tax_exempt_pkg_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_tax_exempt_pkg_void object represents a voided record of a customer
31 tax exemption.  FS::cust_tax_exempt_pkg_void inherits from FS::Record.  The
32 following fields are currently supported:
33
34 =over 4
35
36 =item exemptpkgnum
37
38 primary key
39
40 =item billpkgnum
41
42 billpkgnum
43
44 =item taxnum
45
46 taxnum
47
48 =item year
49
50 year
51
52 =item month
53
54 month
55
56 =item creditbillpkgnum
57
58 creditbillpkgnum
59
60 =item amount
61
62 amount
63
64
65 =back
66
67 =head1 METHODS
68
69 =over 4
70
71 =item new HASHREF
72
73 Creates a new record.  To add the record to the database, see L<"insert">.
74
75 Note that this stores the hash reference, not a distinct copy of the hash it
76 points to.  You can ask the object for a copy with the I<hash> method.
77
78 =cut
79
80 sub table { 'cust_tax_exempt_pkg_void'; }
81
82 =item insert
83
84 Adds this record to the database.  If there is an error, returns the error,
85 otherwise returns false.
86
87 =cut
88
89 =item delete
90
91 Delete this record from the database.
92
93 =cut
94
95 =item replace OLD_RECORD
96
97 Replaces the OLD_RECORD with this one in the database.  If there is an error,
98 returns the error, otherwise returns false.
99
100 =cut
101
102 =item check
103
104 Checks all fields to make sure this is a valid record.  If there is
105 an error, returns the error, otherwise returns false.  Called by the insert
106 and replace methods.
107
108 =cut
109
110 sub check {
111   my $self = shift;
112
113   my $error = 
114     $self->ut_number('exemptpkgnum')
115     || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg_void', 'billpkgnum' )
116     || $self->ut_foreign_key('taxnum', 'cust_main_county', 'taxnum')
117     || $self->ut_numbern('year')
118     || $self->ut_numbern('month')
119     || $self->ut_numbern('creditbillpkgnum') #no FK check, will have been del'ed
120     || $self->ut_money('amount')
121     || $self->ut_flag('exempt_cust')
122     || $self->ut_flag('exempt_setup')
123     || $self->ut_flag('exempt_recur')
124     || $self->ut_flag('exempt_cust_taxname')
125     || $self->ut_flag('exempt_monthly')
126   ;
127   return $error if $error;
128
129   $self->SUPER::check;
130 }
131
132 =back
133
134 =head1 BUGS
135
136 =head1 SEE ALSO
137
138 L<FS::Record>, schema.html from the base documentation.
139
140 =cut
141
142 1;
143