Freeside:3:Documentation:Developer/FS/rate region

From Freeside
Jump to: navigation, search

NAME

FS::rate_region - Object methods for rate_region records

SYNOPSIS

 use FS::rate_region;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::rate_region object represents an call rating region. FS::rate_region inherits from FS::Record. The following fields are currently supported:

regionnum - primary key; regionname - name of the region; exact_match - 'Y' if "prefixes" in this region really represent complete phone numbers. Null if they represent prefixes (the usual case).

METHODS

new HASHREF
Creates a new region. To add the region 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 [ , OPTION => VALUE ... ]
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
Currently available options are: rate_prefix and dest_detail
If rate_prefix is set to an array reference of FS::rate_prefix objects, the objects will have their regionnum field set and will be inserted after this record.
If dest_detail is set to an array reference of FS::rate_detail objects, the objects will have their dest_regionnum field set and will be inserted after this record.
delete
Delete this record from the database.
replace OLD_RECORD [ , OPTION => VALUE ... ]
Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns false.
Currently available options are: rate_prefix and dest_detail
If rate_prefix is set to an array reference of FS::rate_prefix objects, the objects will have their regionnum field set and will be inserted after this record. Any existing rate_prefix records associated with this record will be deleted.
If dest_detail is set to an array reference of FS::rate_detail objects, the objects will have their dest_regionnum field set and will be inserted after this record. Any existing rate_detail records associated with this record will be deleted.
check
Checks all fields to make sure this is a valid region. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
rate_prefix
Returns all prefixes (see FS::rate_prefix) for this region.
dest_detail
Returns all rate details (see FS::rate_detail) for this region as a destionation.
prefixes_short
Returns a string representing all the prefixes for this region.

BUGS

SEE ALSO

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