RT 3.8.17 Documentation

RT::Scrip Overlay

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.

SetScripAction

SetScripCondition

SetTemplate

← Back to index