fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git] / FS / FS / cust_bill_pkg_tax_location_void.pm
1 package FS::cust_bill_pkg_tax_location_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_pkg;
8 use FS::cust_location;
9
10 =head1 NAME
11
12 FS::cust_bill_pkg_tax_location_void - Object methods for cust_bill_pkg_tax_location_void records
13
14 =head1 SYNOPSIS
15
16   use FS::cust_bill_pkg_tax_location_void;
17
18   $record = new FS::cust_bill_pkg_tax_location_void \%hash;
19   $record = new FS::cust_bill_pkg_tax_location_void { 'column' => 'value' };
20
21   $error = $record->insert;
22
23   $error = $new_record->replace($old_record);
24
25   $error = $record->delete;
26
27   $error = $record->check;
28
29 =head1 DESCRIPTION
30
31 An FS::cust_bill_pkg_tax_location_void object represents a voided record
32 of taxation based on package location.  FS::cust_bill_pkg_tax_location_void
33 inherits from FS::Record.  The following fields are currently supported:
34
35 =over 4
36
37 =item billpkgtaxlocationnum
38
39 primary key
40
41 =item billpkgnum
42
43 billpkgnum
44
45 =item taxnum
46
47 taxnum
48
49 =item taxtype
50
51 taxtype
52
53 =item pkgnum
54
55 pkgnum
56
57 =item locationnum
58
59 locationnum
60
61 =item amount
62
63 amount
64
65
66 =back
67
68 =head1 METHODS
69
70 =over 4
71
72 =item new HASHREF
73
74 Creates a new record.  To add the record to the database, see L<"insert">.
75
76 Note that this stores the hash reference, not a distinct copy of the hash it
77 points to.  You can ask the object for a copy with the I<hash> method.
78
79 =cut
80
81 sub table { 'cust_bill_pkg_tax_location_void'; }
82
83 =item insert
84
85 Adds this record to the database.  If there is an error, returns the error,
86 otherwise returns false.
87
88 =cut
89
90 =item delete
91
92 Delete this record from the database.
93
94 =cut
95
96 =item replace OLD_RECORD
97
98 Replaces the OLD_RECORD with this one in the database.  If there is an error,
99 returns the error, otherwise returns false.
100
101 =cut
102
103 =item check
104
105 Checks all fields to make sure this is a valid record.  If there is
106 an error, returns the error, otherwise returns false.  Called by the insert
107 and replace methods.
108
109 =cut
110
111 sub check {
112   my $self = shift;
113
114   my $error = 
115     $self->ut_number('billpkgtaxlocationnum')
116     || $self->ut_foreign_key('billpkgnum', 'cust_bill_pkg_void', 'billpkgnum' )
117     || $self->ut_number('taxnum') #cust_bill_pkg/tax_rate key, based on taxtype
118     || $self->ut_enum('taxtype', [ qw( FS::cust_main_county FS::tax_rate ) ] )
119     || $self->ut_number('pkgnum', 'cust_pkg', 'pkgnum' )
120     || $self->ut_foreign_key('locationnum', 'cust_location', 'locationnum' )
121     || $self->ut_money('amount')
122     || $self->ut_foreign_keyn('taxable_billpkgnum', 'cust_bill_pkg_void', 'billpkgnum')
123   ;
124   return $error if $error;
125
126   $self->SUPER::check;
127 }
128
129 =back
130
131 =head1 BUGS
132
133 =head1 SEE ALSO
134
135 L<FS::Record>, schema.html from the base documentation.
136
137 =cut
138
139 1;
140