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

From Freeside
Jump to: navigation, search
m (Edit via perl MediaWiki framework (1.13))
 
m (Edit via perl MediaWiki framework (1.13))
Line 20: Line 20:
 
An FS::rate object represents an rate plan. FS::rate inherits from FS::Record. The following fields are currently supported:
 
An FS::rate object represents an rate plan. FS::rate inherits from FS::Record. The following fields are currently supported:
  
; ratenum - primary key; ratename
+
; ratenum
 +
:primary key
 +
; ratename
 +
:Rate name
 +
; agentnum
 +
:Optional agent (see [[Freeside:3:Documentation:Developer/FS/agent|FS::agent]]) for agent-virtualized rates.
 +
 
 
==METHODS==
 
==METHODS==
 
; new HASHREF
 
; new HASHREF
Line 48: Line 54:
 
:; ''countrycode'' - required.:; ''phonenum'' - required.:; ''weektime'' - optional. Specifies a time in seconds from the start of the week, and will return a timed rate (one with a non-null ''ratetimenum'') if one exists at that time. If not, returns a non-timed rate.:; ''cdrtypenum'' - optional. Specifies a value for the cdrtypenum field, and will return a rate matching that, if one exists. If not, returns a rate with null cdrtypenum.:; rate_detail
 
:; ''countrycode'' - required.:; ''phonenum'' - required.:; ''weektime'' - optional. Specifies a time in seconds from the start of the week, and will return a timed rate (one with a non-null ''ratetimenum'') if one exists at that time. If not, returns a non-timed rate.:; ''cdrtypenum'' - optional. Specifies a value for the cdrtypenum field, and will return a rate matching that, if one exists. If not, returns a rate with null cdrtypenum.:; rate_detail
 
::Returns all region-specific details (see [[Freeside:3:Documentation:Developer/FS/rate detail|FS::rate_detail]]) for this rate.
 
::Returns all region-specific details (see [[Freeside:3:Documentation:Developer/FS/rate detail|FS::rate_detail]]) for this rate.
 
+
:; agent
 
==SUBROUTINES==
 
==SUBROUTINES==
 
; process
 
; process
:Experimental job-queue processor for web interface adds/edits
+
:Job-queue processor for web interface adds/edits
  
 
==BUGS==
 
==BUGS==
Line 60: Line 66:
 
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 384:
+
; Around line 411:
 
:You forgot a '=back' before '=head1'
 
:You forgot a '=back' before '=head1'
; Around line 461:
+
; Around line 488:
 
:You forgot a '=back' before '=head1'
 
:You forgot a '=back' before '=head1'

Revision as of 13:38, 27 June 2014

NAME

FS::rate - Object methods for rate records

SYNOPSIS

 use FS::rate;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::rate object represents an rate plan. FS::rate inherits from FS::Record. The following fields are currently supported:

ratenum
primary key
ratename
Rate name
agentnum
Optional agent (see FS::agent) for agent-virtualized rates.

METHODS

new HASHREF
Creates a new rate plan. To add the rate plan 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_detail
If rate_detail is set to an array reference of FS::rate_detail objects, the objects will have their ratenum 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_detail
If rate_detail is set to an array reference of FS::rate_detail objects, the objects will have their ratenum 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 rate plan. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
dest_detail REGIONNUM | RATE_REGION_OBJECTD | HASHREF
Returns the rate detail (see FS::rate_detail) for this rate to the specificed destination, or the empty string if no rate can be found for the given destination.
Destination can be specified as an FS::rate_detail object or regionnum (see FS::rate_detail), or as a hashref containing the following keys:
countrycode - required.
; phonenum - required.:; weektime - optional. Specifies a time in seconds from the start of the week, and will return a timed rate (one with a non-null ratetimenum) if one exists at that time. If not, returns a non-timed rate.:; cdrtypenum - optional. Specifies a value for the cdrtypenum field, and will return a rate matching that, if one exists. If not, returns a rate with null cdrtypenum.:; rate_detail
Returns all region-specific details (see FS::rate_detail) for this rate.
agent

SUBROUTINES

process
Job-queue processor for web interface adds/edits

BUGS

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 411:
You forgot a '=back' before '=head1'
Around line 488:
You forgot a '=back' before '=head1'