per-agent disable_previous_balance, #15863
[freeside.git] / FS / FS / cust_main_exemption.pm
1 package FS::cust_main_exemption;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
6 use FS::cust_main;
7
8 =head1 NAME
9
10 FS::cust_main_exemption - Object methods for cust_main_exemption records
11
12 =head1 SYNOPSIS
13
14   use FS::cust_main_exemption;
15
16   $record = new FS::cust_main_exemption \%hash;
17   $record = new FS::cust_main_exemption { 'column' => 'value' };
18
19   $error = $record->insert;
20
21   $error = $new_record->replace($old_record);
22
23   $error = $record->delete;
24
25   $error = $record->check;
26
27 =head1 DESCRIPTION
28
29 An FS::cust_main_exemption object represents a customer tax exemption from a
30 specific tax name (prefix).  FS::cust_main_exemption inherits from
31 FS::Record.  The following fields are currently supported:
32
33 =over 4
34
35 =item exemptionnum
36
37 Primary key
38
39 =item custnum
40
41 Customer (see L<FS::cust_main>)
42
43 =item taxname
44
45 taxname
46
47
48 =back
49
50 =head1 METHODS
51
52 =over 4
53
54 =item new HASHREF
55
56 Creates a new record.  To add the record 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 # the new method can be inherited from FS::Record, if a table method is defined
64
65 sub table { 'cust_main_exemption'; }
66
67 =item insert
68
69 Adds this record to the database.  If there is an error, returns the error,
70 otherwise returns false.
71
72 =cut
73
74 # the insert method can be inherited from FS::Record
75
76 =item delete
77
78 Delete this record from the database.
79
80 =cut
81
82 # the delete method can be inherited from FS::Record
83
84 =item replace OLD_RECORD
85
86 Replaces the OLD_RECORD with this one in the database.  If there is an error,
87 returns the error, otherwise returns false.
88
89 =cut
90
91 # the replace method can be inherited from FS::Record
92
93 =item check
94
95 Checks all fields to make sure this is a valid record.  If there is
96 an error, returns the error, otherwise returns false.  Called by the insert
97 and replace methods.
98
99 =cut
100
101 # the check method should currently be supplied - FS::Record contains some
102 # data checking routines
103
104 sub check {
105   my $self = shift;
106
107   my $error = 
108     $self->ut_numbern('exemptionnum')
109     || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
110     || $self->ut_text('taxname')
111   ;
112   return $error if $error;
113
114   $self->SUPER::check;
115 }
116
117 =back
118
119 =head1 BUGS
120
121 =head1 SEE ALSO
122
123 L<FS::cust_main>, L<FS::Record>, schema.html from the base documentation.
124
125 =cut
126
127 1;
128