1 package FS::cust_main_county;
4 use vars qw(@ISA @EXPORT_OK);
6 use FS::Record qw(fields hfields qsearch qsearchs);
8 @ISA = qw(FS::Record Exporter);
9 @EXPORT_OK = qw(hfields);
13 FS::cust_main_county - Object methods for cust_main_county objects
17 use FS::cust_main_county;
19 $record = create FS::cust_main_county \%hash;
20 $record = create FS::cust_main_county { 'column' => 'value' };
22 $error = $record->insert;
24 $error = $new_record->replace($old_record);
26 $error = $record->delete;
28 $error = $record->check;
32 An FS::cust_main_county object represents a tax rate, defined by locale.
33 FS::cust_main_county inherits from FS::Record. The following fields are
38 =item taxnum - primary key (assigned automatically for new tax rates)
44 =item tax - percentage
54 Creates a new tax rate. To add the tax rate to the database, see L<"insert">.
59 my($proto,$hashref)=@_;
61 #now in FS::Record::new
63 #foreach $field (fields('cust_main_county')) {
64 # $hashref->{$field}='' unless defined $hashref->{$field};
67 $proto->new('cust_main_county',$hashref);
72 Adds this tax rate to the database. If there is an error, returns the error,
73 otherwise returns false.
86 Deletes this tax rate from the database. If there is an error, returns the
87 error, otherwise returns false.
97 =item replace OLD_RECORD
99 Replaces the OLD_RECORD with this one in the database. If there is an error,
100 returns the error, otherwise returns false.
106 return "(Old) Not a cust_main_county record!"
107 unless $old->table eq "cust_main_county";
108 return "Can't change taxnum!"
109 unless $old->getfield('taxnum') eq $new->getfield('taxnum');
116 Checks all fields to make sure this is a valid tax rate. If there is an error,
117 returns the error, otherwise returns false. Called by the insert and replace
124 return "Not a cust_main_county record!"
125 unless $self->table eq "cust_main_county";
126 my($recref) = $self->hashref;
128 $self->ut_numbern('taxnum')
129 or $self->ut_text('state')
130 or $self->ut_textn('county')
131 or $self->ut_float('tax')
140 It doesn't properly override FS::Record yet.
142 A country field (and possibly a currency field) should be added.
146 L<FS::Record>, L<FS::cust_main>, L<FS::cust_bill>, schema.html from the base
151 ivan@voicenet.com 97-dec-16
153 Changed check for 'tax' to use the new ut_float subroutine
154 bmccane@maxbaud.net 98-apr-3
156 pod ivan@sisd.com 98-sep-21