enable CardFortress in test database, #71513
[freeside.git] / FS / FS / quotation_pkg_tax.pm
1 package FS::quotation_pkg_tax;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6 use FS::cust_main_county;
7 use FS::quotation_pkg;
8
9 =head1 NAME
10
11 FS::quotation_pkg_tax - Object methods for quotation_pkg_tax records
12
13 =head1 SYNOPSIS
14
15   use FS::quotation_pkg_tax;
16
17   $record = new FS::quotation_pkg_tax \%hash;
18   $record = new FS::quotation_pkg_tax { '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::quotation_pkg_tax object represents tax on a quoted package. 
31 FS::quotation_pkg_tax inherits from FS::Record (though it should eventually
32 inherit from some shared superclass of L<FS::cust_bill_pkg_tax_location>). 
33 The following fields are currently supported:
34
35 =over 4
36
37 =item quotationtaxnum - primary key
38
39 =item quotationpkgnum - the L<FS::quotation_pkg> record that the tax applies 
40 to.
41
42 =item itemdesc - the name of the tax
43
44 =item setup_amount - the amount of tax calculated on one-time charges
45
46 =item recur_amount - the amount of tax calculated on recurring charges
47
48 =back
49
50 =head1 METHODS
51
52 =over 4
53
54 =item new HASHREF
55
56 Creates a new estimated tax amount.  To add the record to the database, 
57 see L<"insert">.
58
59 =cut
60
61 sub table { 'quotation_pkg_tax'; }
62
63 =item insert
64
65 Adds this record to the database.  If there is an error, returns the error,
66 otherwise returns false.
67
68 =item delete
69
70 Delete this record from the database.
71
72 =item replace OLD_RECORD
73
74 Replaces the OLD_RECORD with this one in the database.  If there is an error,
75 returns the error, otherwise returns false.
76
77 =item check
78
79 Checks all fields to make sure this is a valid example.  If there is
80 an error, returns the error, otherwise returns false.  Called by the insert
81 and replace methods.
82
83 =cut
84
85 sub check {
86   my $self = shift;
87
88   my $error = 
89     $self->ut_numbern('quotationtaxnum')
90     || $self->ut_foreign_key('quotationpkgnum', 'quotation_pkg', 'quotationpkgnum')
91     || $self->ut_text('itemdesc')
92     || $self->ut_money('setup_amount')
93     || $self->ut_money('recur_amount')
94   ;
95   return $error if $error;
96
97   $self->SUPER::check;
98 }
99
100 =back
101
102 =head1 SEE ALSO
103
104 L<FS::Record>, schema.html from the base documentation.
105
106 =cut
107
108 1;
109