Difference between revisions of "Freeside:4:Documentation:Developer/FS/rate time interval"

From Freeside
Jump to: navigation, search
(Edit via perl MediaWiki framework (1.13))
 
(No difference)

Latest revision as of 07:28, 18 November 2015

NAME

FS::rate_time_interval - Object methods for rate_time_interval records

SYNOPSIS

 use FS::rate_time_interval;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::rate_time_interval object represents an interval of clock time during the week, such as "Monday, 7 AM to 8 PM". FS::rate_time_interval inherits from FS::Record. The following fields are currently supported:

intervalnum
primary key
stime
Start of the interval, in seconds from midnight on Sunday.
etime
End of the interval.
ratetimenum
A foreign key to an FS::rate_time object representing the set of intervals to which this belongs.

METHODS

new HASHREF
Creates a new example. To add the example 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 interval. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
rate_time
Returns the FS::rate_time comprising this interval.
description
Returns two strings containing stime and etime, formatted "Day HH:MM AM/PM". Example: "Mon 5:00 AM". Seconds are not displayed, so be careful.

BUGS

SEE ALSO

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