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

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

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.