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