RT 4.0.24 Documentation

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

RT::Lifecycle

Go to latest version →

NAME

RT::Lifecycle - class to access and manipulate lifecycles

DESCRIPTION

A lifecycle is a list of statuses that a ticket can have. There are three groups of statuses: initial, active and inactive. A lifecycle also defines possible transitions between statuses. For example, in the 'default' lifecycle, you may only change status from 'stalled' to 'open'.

It is also possible to define user-interface labels and the action a user should perform during a transition. For example, the "open -> stalled" transition would have a 'Stall' label and the action would be Comment. The action only defines what form is showed to the user, but actually performing the action is not required. The user can leave the comment box empty yet still Stall a ticket. Finally, the user can also just use the Basics or Jumbo form to change the status with the usual dropdown.

METHODS

new

Simple constructor, takes no arguments.

Load

Takes a name of the lifecycle and loads it. If name is empty or undefined then loads the global lifecycle with statuses from all named lifecycles.

Can be called as class method, returns a new object, for example:

    my $lifecycle = RT::Lifecycle->Load('default');

List

Returns sorted list of the lifecycles' names.

Name

Returns name of the laoded lifecycle.

Queues

Returns RT::Queues collection with queues that use this lifecycle.

Getting statuses and validating.

Methods to get statuses in different sets or validating them.

Valid

Returns an array of all valid statuses for the current lifecycle. Statuses are not sorted alphabetically, instead initial goes first, then active and then inactive.

Takes optional list of status types, from 'initial', 'active' or 'inactive'. For example:

    $lifecycle->Valid('initial', 'active');

IsValid

Takes a status and returns true if value is a valid status for the current lifecycle. Otherwise, returns false.

Takes optional list of status types after the status, so it's possible check validity in particular sets, for example:

    # returns true if status is valid and from initial or active set
    $lifecycle->IsValid('some_status', 'initial', 'active');

See also </valid>.

StatusType

Takes a status and returns its type, one of 'initial', 'active' or 'inactive'.

Initial

Returns an array of all initial statuses for the current lifecycle.

IsInitial

Takes a status and returns true if value is a valid initial status. Otherwise, returns false.

Active

Returns an array of all active statuses for this lifecycle.

IsActive

Takes a value and returns true if value is a valid active status. Otherwise, returns false.

Inactive

Returns an array of all inactive statuses for this lifecycle.

IsInactive

Takes a value and returns true if value is a valid inactive status. Otherwise, returns false.

Default statuses

In some cases when status is not provided a default values should be used.

DefaultStatus

Takes a situation name and returns value. Name should be spelled following spelling in the RT config file.

DefaultOnCreate

Returns the status that should be used by default when ticket is created.

DefaultOnMerge

Returns the status that should be used when tickets are merged.

ReminderStatusOnOpen

Returns the status that should be used when reminders are opened.

ReminderStatusOnResolve

Returns the status that should be used when reminders are resolved.

Transitions, rights, labels and actions.

Transitions

Takes status and returns list of statuses it can be changed to.

Is status is empty or undefined then returns list of statuses for a new ticket.

If argument is ommitted then returns a hash with all possible transitions in the following format:

    status_x => [ next_status, next_status, ... ],
    status_y => [ next_status, next_status, ... ],

IsTransition

Takes two statuses (from -> to) and returns true if it's valid transition and false otherwise.

CheckRight

Takes two statuses (from -> to) and returns the right that should be checked on the ticket.

RegisterRights

Registers all defined rights in the system, so they can be addigned to users. No need to call it, as it's called when module is loaded.

RightsDescription

Returns hash with description of rights that are defined for particular transitions.

Actions

Takes a status and returns list of defined actions for the status. Each element in the list is a hash reference with the following key/value pairs:

from - either the status or *
to - next status
label - label of the action
update - 'Respond', 'Comment' or '' (empty string)

Moving tickets between lifecycles

MoveMap

Takes lifecycle as a name string or an object and returns a hash reference with move map from this cycle to provided.

HasMoveMap

Takes a lifecycle as a name string or an object and returns true if move map defined for move from this cycle to provided.

NoMoveMaps

Takes no arguments and returns hash with pairs that has no move maps.

Localization

ForLocalization

A class method that takes no arguments and returns list of strings that require translation.

← Back to index