Difference between revisions of "Freeside:3:Documentation:Developer/FS/tax rate location"

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 18: Line 18:
 
</code>
 
</code>
 
==DESCRIPTION==
 
==DESCRIPTION==
An FS::tax_rate_location object represents an example. FS::tax_rate_location inherits from FS::Record. The following fields are currently supported:
+
An FS::tax_rate_location object represents a tax jurisdiction. The only functional field is "geocode", a foreign key to tax rates ([[Freeside:3:Documentation:Developer/FS/tax rate|FS::tax_rate]]) that apply in the jurisdiction. The city, county, state, and country fields are provided for description and reporting.
  
; taxratelocationnum
+
FS::tax_rate_location inherits from FS::Record. The following fields are currently supported:
:Primary key (assigned automatically for new tax_rate_locations)
 
; data_vendor
 
:The tax data vendor
 
; geocode
 
:A unique geographic location code provided by the data vendor
 
; city
 
:City
 
; county
 
:County
 
; state
 
:State
 
; disabled
 
:If 'Y' this record is no longer active.
 
  
 +
; taxratelocationnum - Primary key (assigned automatically for new tax_rate_locations); data_vendor - The tax data vendor ('cch' or 'billsoft').; geocode - A unique geographic location code provided by the data vendor; city - City; county - County; state - State (2-letter code); country - Country (2-letter code, optional); disabled - If 'Y' this record is no longer active.
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 48: Line 36:
 
; check
 
; check
 
:Checks all fields to make sure this is a valid tax rate location. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
 
:Checks all fields to make sure this is a valid tax rate location. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
 +
; find_or_insert
 +
:Finds an existing, non-disabled tax jurisdiction matching the data_vendor and geocode fields. If there is one, updates its city, county, state, and country to match this record. If there is no existing record, inserts this record.
  
 
==CLASS METHODS==
 
==CLASS METHODS==
Line 56: Line 46:
  
 
==SUBROUTINES==
 
==SUBROUTINES==
; batch_import
+
; batch_import HASHREF, JOB
 +
:Starts importing tax_rate_location records from a file. HASHREF must contain 'filehandle' (an open handle to the input file) and 'format' (one of 'cch', 'cch-fixed', 'cch-update', 'cch-fixed-update', or 'billsoft'). JOB is an [[Freeside:3:Documentation:Developer/FS/queue|FS::queue]] object to receive progress messages.
 +
 
 
==BUGS==
 
==BUGS==
 
Currently somewhat specific to CCH supplied data.
 
Currently somewhat specific to CCH supplied data.
Line 66: Line 58:
 
Hey! '''The above document had some coding errors, which are explained below:'''
 
Hey! '''The above document had some coding errors, which are explained below:'''
  
; Around line 156&#58;
+
; Around line 183&#58;
 
:'=item' outside of any '=over'
 
:'=item' outside of any '=over'
; Around line 337&#58;
+
; Around line 395&#58;
 
:You forgot a '=back' before '=head1'
 
:You forgot a '=back' before '=head1'

Revision as of 06:37, 24 March 2015

NAME

FS::tax_rate_location - Object methods for tax_rate_location records

SYNOPSIS

 use FS::tax_rate_location;

 $record = new FS::tax_rate_location \%hash;
 $record = new FS::tax_rate_location { 'column' => 'value' };

 $error = $record->insert;

 $error = $new_record->replace($old_record);

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::tax_rate_location object represents a tax jurisdiction. The only functional field is "geocode", a foreign key to tax rates (FS::tax_rate) that apply in the jurisdiction. The city, county, state, and country fields are provided for description and reporting.

FS::tax_rate_location inherits from FS::Record. The following fields are currently supported:

taxratelocationnum - Primary key (assigned automatically for new tax_rate_locations); data_vendor - The tax data vendor ('cch' or 'billsoft').; geocode - A unique geographic location code provided by the data vendor; city - City; county - County; state - State (2-letter code); country - Country (2-letter code, optional); disabled - If 'Y' this record is no longer active.

METHODS

new HASHREF
Creates a new tax rate location. To add the record to the database, see "insert".
Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the hash method.
insert
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
delete
Delete this record from the database.
replace OLD_RECORD
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
check
Checks all fields to make sure this is a valid tax rate location. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
find_or_insert
Finds an existing, non-disabled tax jurisdiction matching the data_vendor and geocode fields. If there is one, updates its city, county, state, and country to match this record. If there is no existing record, inserts this record.

CLASS METHODS

location_sql KEY => VALUE, ...
Returns an SQL fragment identifying matching tax_rate_location / cust_bill_pkg_tax_rate_location records.
Parameters are county, state, city and locationtaxid

SUBROUTINES

batch_import HASHREF, JOB
Starts importing tax_rate_location records from a file. HASHREF must contain 'filehandle' (an open handle to the input file) and 'format' (one of 'cch', 'cch-fixed', 'cch-update', 'cch-fixed-update', or 'billsoft'). JOB is an FS::queue object to receive progress messages.

BUGS

Currently somewhat specific to CCH supplied data.

SEE ALSO

FS::Record, schema.html from the base documentation.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 183:
'=item' outside of any '=over'
Around line 395:
You forgot a '=back' before '=head1'