1 package FS::cust_main_exemption;
4 use base qw( FS::Record );
5 use FS::Record qw( qsearch qsearchs );
11 FS::cust_main_exemption - Object methods for cust_main_exemption records
15 use FS::cust_main_exemption;
17 $record = new FS::cust_main_exemption \%hash;
18 $record = new FS::cust_main_exemption { 'column' => 'value' };
20 $error = $record->insert;
22 $error = $new_record->replace($old_record);
24 $error = $record->delete;
26 $error = $record->check;
30 An FS::cust_main_exemption object represents a customer tax exemption from a
31 specific tax name (prefix). FS::cust_main_exemption inherits from
32 FS::Record. The following fields are currently supported:
42 Customer (see L<FS::cust_main>)
60 Creates a new record. To add the record to the database, see L<"insert">.
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.
67 # the new method can be inherited from FS::Record, if a table method is defined
69 sub table { 'cust_main_exemption'; }
73 Adds this record to the database. If there is an error, returns the error,
74 otherwise returns false.
78 # the insert method can be inherited from FS::Record
82 Delete this record from the database.
86 # the delete method can be inherited from FS::Record
88 =item replace OLD_RECORD
90 Replaces the OLD_RECORD with this one in the database. If there is an error,
91 returns the error, otherwise returns false.
95 # the replace method can be inherited from FS::Record
99 Checks all fields to make sure this is a valid record. If there is
100 an error, returns the error, otherwise returns false. Called by the insert
105 # the check method should currently be supplied - FS::Record contains some
106 # data checking routines
112 $self->ut_numbern('exemptionnum')
113 || $self->ut_foreign_key('custnum', 'cust_main', 'custnum')
114 || $self->ut_text('taxname')
115 || $self->ut_textn('exempt_number')
117 return $error if $error;
119 my $conf = new FS::Conf;
120 if ( ! $self->exempt_number && $conf->exists('tax-cust_exempt-groups-require_individual_nums') ) {
121 return 'Tax exemption number required for '. $self->taxname. ' exemption';
133 L<FS::cust_main>, L<FS::Record>, schema.html from the base documentation.