RT::Scrip - an RT Scrip object
use RT::Scrip;
Creates a new entry in the Scrips table. Takes a paramhash with:
Queue => 0,
Description => undef,
Template => undef,
ScripAction => undef,
ScripCondition => undef,
CustomPrepareCode => undef,
CustomCommitCode => undef,
CustomIsApplicableCode => undef,
Returns (retval, msg); retval is 0 for failure or scrip id. msg is a textual description of what happened.
Delete this object
Adds (applies) the current scrip to the provided queue (ObjectId).
Accepts a param hash of:
ObjectId
Queue name or id. 0 makes the scrip global.
Stage
Stage to run in. Valid stages are TransactionCreate or TransactionBatch. Defaults to TransactionCreate. As of RT 4.2, Disabled is no longer a stage.
Template
Name of global or queue-specific template for the scrip. Use 'Blank' for non-notification scrips.
SortOrder
Number indicating the relative order the scrip should run in.
Returns (val, message). If val is false, the message contains an error message.
Removes the current scrip to the provided queue (ObjectId).
Accepts a param hash of:
ObjectId
Queue name or id. 0 makes the scrip global.
Returns (val, message). If val is false, the message contains an error message.
Retuns an RT::Action object with this Scrip's Action
Retuns an RT::ScripCondition object with this Scrip's IsApplicable
Loads scrip's condition and action modules.
Retuns an RT::Template object with this Scrip's Template
Takes TicketObj named argument and returns scrip's stage when added to ticket's queue.
Helper function that returns a localized human-readable version of the $Stage
argument.
This method instantiates the ScripCondition and ScripAction objects for a single execution of this scrip. it then calls the IsApplicable method of the ScripCondition. If that succeeds, it calls the Prepare method of the ScripAction. If that succeeds, it calls the Commit method of the ScripAction.
Usually, the ticket and transaction objects passed to this method should be loaded by the SuperUser role
Calls the Condition object's IsApplicable method
Upon success, returns the applicable Transaction object. Otherwise, undef is returned.
If the Scrip is in the TransactionCreate Stage (the usual case), only test the associated Transaction object to see if it is applicable.
For Scrips in the TransactionBatch Stage, test all Transaction objects created during the Ticket object's lifetime, and returns the first one that is applicable.
Calls the action object's prepare method
Calls the action object's commit method
Having rights on any of the queues the scrip applies to is equivalent to having rights on the scrip.
This routine compile-checks the custom prepare, commit, and is-applicable code to see if they are syntactically valid Perl. We eval them in a codeblock to avoid actually executing the code.
If one of the fields has a compile error, only the first is reported.
Returns an (ok, message) pair.
Returns the current value of id. (In the database, id is stored as int(11).)
Returns the current value of Description. (In the database, Description is stored as varchar(255).)
Set Description to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Description will be stored as a varchar(255).)
Returns the current value of ScripCondition. (In the database, ScripCondition is stored as int(11).)
Set ScripCondition to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ScripCondition will be stored as a int(11).)
Returns the ScripCondition Object which has the id returned by ScripCondition
Returns the current value of ScripAction. (In the database, ScripAction is stored as int(11).)
Set ScripAction to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ScripAction will be stored as a int(11).)
Returns the ScripAction Object which has the id returned by ScripAction
Returns the current value of CustomIsApplicableCode. (In the database, CustomIsApplicableCode is stored as text.)
Set CustomIsApplicableCode to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, CustomIsApplicableCode will be stored as a text.)
Returns the current value of CustomPrepareCode. (In the database, CustomPrepareCode is stored as text.)
Set CustomPrepareCode to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, CustomPrepareCode will be stored as a text.)
Returns the current value of CustomCommitCode. (In the database, CustomCommitCode is stored as text.)
Set CustomCommitCode to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, CustomCommitCode will be stored as a text.)
Returns the current value of Disabled. (In the database, Disabled is stored as smallint(6).)
Set Disabled to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Disabled will be stored as a smallint(6).)
Returns the current value of Template. (In the database, Template is stored as varchar(200).)
Set Template to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Template will be stored as a varchar(200).)
Returns the current value of Creator. (In the database, Creator is stored as int(11).)
Returns the current value of Created. (In the database, Created is stored as datetime.)
Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).)
Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.)
← Back to index