checkpoint of new tax rating system
[freeside.git] / FS / FS / part_pkg_taxproduct.pm
1 package FS::part_pkg_taxproduct;
2
3 use strict;
4 use vars qw( @ISA );
5 use FS::Record;
6
7 @ISA = qw(FS::Record);
8
9 =head1 NAME
10
11 FS::part_pkg_taxproduct - Object methods for part_pkg_taxproduct records
12
13 =head1 SYNOPSIS
14
15   use FS::part_pkg_taxproduct;
16
17   $record = new FS::part_pkg_taxproduct \%hash;
18   $record = new FS::part_pkg_taxproduct { '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::part_pkg_taxproduct object represents a tax product. 
31 FS::part_pkg_taxproduct inherits from FS::Record.  The following fields are
32 currently supported:
33
34 =over 4
35
36 =item taxproductnum
37
38 Primary key
39
40 =item data_vendor
41
42 Tax data vendor
43
44 =item taxproduct
45
46 Tax product id from the vendor
47
48 =item description
49
50 A human readable description of the id in taxproduct
51
52 =back
53
54 =head1 METHODS
55
56 =over 4
57
58 =item new HASHREF
59
60 Creates a new tax product.  To add the tax product to the database, see L<"insert">.
61
62 Note that this stores the hash reference, not a distinct copy of the hash it
63 points to.  You can ask the object for a copy with the I<hash> method.
64
65 =cut
66
67 sub table { 'part_pkg_taxproduct'; }
68
69 =item insert
70
71 Adds this record to the database.  If there is an error, returns the error,
72 otherwise returns false.
73
74 =cut
75
76 =item delete
77
78 Delete this record from the database.
79
80 =cut
81
82 =item replace OLD_RECORD
83
84 Replaces the OLD_RECORD with this one in the database.  If there is an error,
85 returns the error, otherwise returns false.
86
87 =cut
88
89 =item check
90
91 Checks all fields to make sure this is a valid tax product.  If there is
92 an error, returns the error, otherwise returns false.  Called by the insert
93 and replace methods.
94
95 =cut
96
97 sub check {
98   my $self = shift;
99
100   my $error = 
101     $self->ut_numbern('taxproductnum')
102     || $self->ut_textn('data_vendor')
103     || $self->ut_text('taxproduct')
104     || $self->ut_textn('description')
105   ;
106   return $error if $error;
107
108   $self->SUPER::check;
109 }
110
111 =back
112
113 =cut
114
115 =head1 BUGS
116
117 =head1 SEE ALSO
118
119 L<FS::Record>, schema.html from the base documentation.
120
121 =cut
122
123 1;
124