Freeside:4:Documentation:Developer/FS/queue
From Freeside
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 (new, locked, or failed)
- statustext
- Freeform text status message
- _date
- UNIX timestamp
- svcnum
- Optional link to service (see FS::cust_svc).
- custnum
- Optional link to customer (see FS::cust_main).
- secure
- Secure flag, 'Y' indicates that when using encryption, the job needs to be run on a machine with the private key.
- usernum
- For access_user that created the job
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.