1 package FS::cust_tax_exempt;
5 use FS::Record qw( qsearch qsearchs );
6 use FS::cust_main_Mixin;
8 use FS::cust_main_county;
10 @ISA = qw( FS::cust_main_Mixin FS::Record );
14 FS::cust_tax_exempt - Object methods for cust_tax_exempt records
18 use FS::cust_tax_exempt;
20 $record = new FS::cust_tax_exempt \%hash;
21 $record = new FS::cust_tax_exempt { 'column' => 'value' };
23 $error = $record->insert;
25 $error = $new_record->replace($old_record);
27 $error = $record->delete;
29 $error = $record->check;
33 An FS::cust_tax_exempt object represents a record of an old-style customer tax
34 exemption. Currently this is only used for "texas tax". FS::cust_tax_exempt
35 inherits from FS::Record. The following fields are currently supported:
39 =item exemptnum - primary key
41 =item custnum - customer (see L<FS::cust_main>)
43 =item taxnum - tax rate (see L<FS::cust_main_county>)
55 Old-style customer tax exemptions are only useful for legacy migrations - if
56 you are looking for current customer tax exemption data see
57 L<FS::cust_tax_exempt_pkg>.
65 Creates a new exemption record. To add the example to the database, see
68 Note that this stores the hash reference, not a distinct copy of the hash it
69 points to. You can ask the object for a copy with the I<hash> method.
73 # the new method can be inherited from FS::Record, if a table method is defined
75 sub table { 'cust_tax_exempt'; }
79 Adds this record to the database. If there is an error, returns the error,
80 otherwise returns false.
84 # the insert method can be inherited from FS::Record
88 Delete this record from the database.
92 # the delete method can be inherited from FS::Record
94 =item replace OLD_RECORD
96 Replaces the OLD_RECORD with this one in the database. If there is an error,
97 returns the error, otherwise returns false.
101 # the replace method can be inherited from FS::Record
105 Checks all fields to make sure this is a valid example. If there is
106 an error, returns the error, otherwise returns false. Called by the insert
111 # the check method should currently be supplied - FS::Record contains some
112 # data checking routines
117 $self->ut_numbern('exemptnum')
118 || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
119 || $self->ut_foreign_key('taxnum', 'cust_main_county', 'taxnum')
120 || $self->ut_number('year') #check better
121 || $self->ut_number('month') #check better
122 || $self->ut_money('amount')
123 || $self->SUPER::check
127 =item cust_main_county
129 Returns the FS::cust_main_county object associated with this tax exemption.
133 sub cust_main_county {
135 qsearchs( 'cust_main_county', { 'taxnum' => $self->taxnum } );
142 Texas tax is a royal pain in the ass.
146 L<FS::cust_main_county>, L<FS::cust_main>, L<FS::Record>, schema.html from the