This commit was generated by cvs2svn to compensate for changes in r3921,
[freeside.git] / FS / FS / cust_tax_exempt.pm
1 package FS::cust_tax_exempt;
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_tax_exempt - Object methods for cust_tax_exempt records
12
13 =head1 SYNOPSIS
14
15   use FS::cust_tax_exempt;
16
17   $record = new FS::cust_tax_exempt \%hash;
18   $record = new FS::cust_tax_exempt { '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 object represents a historical record of a customer tax
31 exemption.  Currently this is only used for "texas tax".  FS::cust_tax_exempt
32 inherits from FS::Record.  The following fields are currently supported:
33
34 =over 4
35
36 =item exemptnum - primary key
37
38 =item custnum - customer (see L<FS::cust_main>)
39
40 =item taxnum - tax rate (see L<FS::cust_main_county>)
41
42 =item year
43
44 =item month
45
46 =item amount
47
48 =back
49
50 =head1 METHODS
51
52 =over 4
53
54 =item new HASHREF
55
56 Creates a new exemption record.  To add the example to the database, see
57 L<"insert">.
58
59 Note that this stores the hash reference, not a distinct copy of the hash it
60 points to.  You can ask the object for a copy with the I<hash> method.
61
62 =cut
63
64 # the new method can be inherited from FS::Record, if a table method is defined
65
66 sub table { 'cust_tax_exempt'; }
67
68 =item insert
69
70 Adds this record to the database.  If there is an error, returns the error,
71 otherwise returns false.
72
73 =cut
74
75 # the insert method can be inherited from FS::Record
76
77 =item delete
78
79 Delete this record from the database.
80
81 =cut
82
83 # the delete method can be inherited from FS::Record
84
85 =item replace OLD_RECORD
86
87 Replaces the OLD_RECORD with this one in the database.  If there is an error,
88 returns the error, otherwise returns false.
89
90 =cut
91
92 # the replace method can be inherited from FS::Record
93
94 =item check
95
96 Checks all fields to make sure this is a valid example.  If there is
97 an error, returns the error, otherwise returns false.  Called by the insert
98 and replace methods.
99
100 =cut
101
102 # the check method should currently be supplied - FS::Record contains some
103 # data checking routines
104
105 sub check {
106   my $self = shift;
107
108   $self->ut_numbern('exemptnum')
109     || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
110     || $self->ut_foreign_key('taxnum', 'cust_main_county', 'taxnum')
111     || $self->ut_number('year') #check better
112     || $self->ut_number('month') #check better
113     || $self->ut_money('amount')
114     || $self->SUPER::check
115   ;
116 }
117
118 =back
119
120 =head1 BUGS
121
122 Texas tax is a royal pain in the ass.
123
124 =head1 SEE ALSO
125
126 L<FS::cust_main_county>, L<FS::cust_main>, L<FS::Record>, schema.html from the
127 base documentation.
128
129 =cut
130
131 1;
132