RT 4.0.25 Documentation

This version has reached its end of life and is out of support. Please contact us for upgrade assistance.

RT::Scrip

Go to latest version →

NAME

  RT::Scrip - an RT Scrip object

SYNOPSIS

  use RT::Scrip;

DESCRIPTION

METHODS

Create

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

Delete this object

QueueObj

Retuns an RT::Queue object with this Scrip's queue

ActionObj

Retuns an RT::Action object with this Scrip's Action

ConditionObj

Retuns an RT::ScripCondition object with this Scrip's IsApplicable

LoadModules

Loads scrip's condition and action modules.

TemplateObj

Retuns an RT::Template object with this Scrip's Template

Apply { TicketObj => undef, TransactionObj => undef}

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

IsApplicable

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.

Prepare

Calls the action object's prepare method

Commit

Calls the action object's commit method

CurrentUserHasRight

Helper menthod for HasRight. Presets Principal to CurrentUser then calls HasRight.

HasRight

Takes a param-hash consisting of "Right" and "Principal" Principal is an RT::User object or an RT::CurrentUser object. "Right" is a textual Right string that applies to Scrips.

CompileCheck

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.

SetScripAction

SetScripCondition

SetTemplate

id

Returns the current value of id. (In the database, id is stored as int(11).)

Description

Returns the current value of Description. (In the database, Description is stored as varchar(255).)

SetDescription VALUE

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).)

ScripCondition

Returns the current value of ScripCondition. (In the database, ScripCondition is stored as int(11).)

SetScripCondition VALUE

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).)

ScripConditionObj

Returns the ScripCondition Object which has the id returned by ScripCondition

ScripAction

Returns the current value of ScripAction. (In the database, ScripAction is stored as int(11).)

SetScripAction VALUE

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).)

ScripActionObj

Returns the ScripAction Object which has the id returned by ScripAction

ConditionRules

Returns the current value of ConditionRules. (In the database, ConditionRules is stored as text.)

SetConditionRules VALUE

Set ConditionRules to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ConditionRules will be stored as a text.)

ActionRules

Returns the current value of ActionRules. (In the database, ActionRules is stored as text.)

SetActionRules VALUE

Set ActionRules to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, ActionRules will be stored as a text.)

CustomIsApplicableCode

Returns the current value of CustomIsApplicableCode. (In the database, CustomIsApplicableCode is stored as text.)

SetCustomIsApplicableCode VALUE

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.)

CustomPrepareCode

Returns the current value of CustomPrepareCode. (In the database, CustomPrepareCode is stored as text.)

SetCustomPrepareCode VALUE

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.)

CustomCommitCode

Returns the current value of CustomCommitCode. (In the database, CustomCommitCode is stored as text.)

SetCustomCommitCode VALUE

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.)

Stage

Returns the current value of Stage. (In the database, Stage is stored as varchar(32).)

SetStage VALUE

Set Stage to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Stage will be stored as a varchar(32).)

Queue

Returns the current value of Queue. (In the database, Queue is stored as int(11).)

SetQueue VALUE

Set Queue to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Queue will be stored as a int(11).)

Template

Returns the current value of Template. (In the database, Template is stored as int(11).)

SetTemplate VALUE

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 int(11).)

Creator

Returns the current value of Creator. (In the database, Creator is stored as int(11).)

Created

Returns the current value of Created. (In the database, Created is stored as datetime.)

LastUpdatedBy

Returns the current value of LastUpdatedBy. (In the database, LastUpdatedBy is stored as int(11).)

LastUpdated

Returns the current value of LastUpdated. (In the database, LastUpdated is stored as datetime.)

← Back to index