Freeside:1.9:Documentation:Developer/FS/queue

From Freeside
< Freeside:1.9:Documentation:Developer‎ | FS
Revision as of 16:26, 3 October 2007 by Ivan (talk | contribs) (import from POD)

Jump to: navigation, search

NAME

FS::queue - Object methods for queue records

SYNOPSIS

 use FS::queue;

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

 $error = $record->insert;

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

 $error = $record->delete;

 $error = $record->check;

DESCRIPTION

An FS::queue object represents an queued job. FS::queue inherits from FS::Record. The following fields are currently supported:

jobnum - primary key; job - fully-qualified subroutine name; status - job status; statustext - freeform text status message; _date - UNIX timestamp; svcnum - optional link to service (see FS::cust_svc)

METHODS

new HASHREF
Creates a new job. To add the job 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 [ ARGUMENT, ARGUMENT... ]
Adds this record to the database. If there is an error, returns the error, otherwise returns false.
If any arguments are supplied, a queue_arg record for each argument is also created (see FS::queue_arg).
delete
Delete this record from the database. Any corresponding queue_arg records are deleted as well
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 job. If there is an error, returns the error, otherwise returns false. Called by the insert and replace methods.
args
Returns a list of the arguments associated with this job.
cust_svc
Returns the FS::cust_svc object associated with this job, if any.
queue_depend
Returns the FS::queue_depend objects associated with this job, if any. (Dependancies that must complete before this job can be run).
depend_insert OTHER_JOBNUM
Inserts a dependancy for this job - it will not be run until the other job specified completes. If there is an error, returns the error, otherwise returns false.
When using job dependancies, you should wrap the insertion of all relevant jobs in a database transaction.
queue_depended
Returns the FS::queue_depend objects that associate other jobs with this job, if any. (The jobs that are waiting for this job to complete before they can run).
depended_delete
Deletes the other queued jobs (FS::queue objects) that are waiting for this job, if any. If there is an error, returns the error, otherwise returns false.
update_statustext VALUE
Updates the statustext value of this job to supplied value, in the database. If there is an error, returns the error, otherwise returns false.

SUBROUTINES

joblisting HASHREF NOACTIONS

BUGS

$jobnums global

SEE ALSO

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