Kernel::System::State - state lib
All ticket state functions.
create an object
my $StateObject = $Kernel::OM->Get('Kernel::System::State');
add new states
my $ID = $StateObject->StateAdd( Name => 'New State', Comment => 'some comment', ValidID => 1, TypeID => 1, UserID => 123, );
get state attributes
my %State = $StateObject->StateGet( Name => 'New State', ); my %State = $StateObject->StateGet( ID => 123, );
returns
my %State = ( Name => "new", ID => 1, TypeName => "new", TypeID => 1, ValidID => 1, CreateTime => "2010-11-29 11:04:04", ChangeTime => "2010-11-29 11:04:04", Comment => "New ticket created by customer.", );
update state attributes
$StateObject->StateUpdate( ID => 123, Name => 'New State', Comment => 'some comment', ValidID => 1, TypeID => 1, UserID => 123, );
get list of states for a type or a list of state types.
Get all states with state type open and new: (available: new, open, closed, pending reminder, pending auto, removed, merged)
my @List = $StateObject->StateGetStatesByType( StateType => ['open', 'new'], Result => 'ID', # HASH|ID|Name );
Get all state types used by config option named like Ticket::ViewableStateType for "Viewable" state types.
my %List = $StateObject->StateGetStatesByType( Type => 'Viewable', Result => 'HASH', # HASH|ID|Name );
get state list as a hash of ID, Name pairs
my %List = $StateObject->StateList( UserID => 123, ); my %List = $StateObject->StateList( UserID => 123, Valid => 1, # is default ); my %List = $StateObject->StateList( UserID => 123, Valid => 0, );
returns
my %List = ( 1 => "new", 2 => "closed successful", 3 => "closed unsuccessful", 4 => "open", 5 => "removed", 6 => "pending reminder", 7 => "pending auto close+", 8 => "pending auto close-", 9 => "merged", );
returns the id or the name of a state
my $StateID = $StateObject->StateLookup( State => 'closed successful', ); my $State = $StateObject->StateLookup( StateID => 2, );
get state type list as a hash of ID, Name pairs
my %ListType = $StateObject->StateTypeList( UserID => 123, );
returns
my %ListType = ( 1 => "new", 2 => "open", 3 => "closed", 4 => "pending reminder", 5 => "pending auto", 6 => "removed", 7 => "merged", );
returns the id or the name of a state type
my $StateTypeID = $StateObject->StateTypeLookup( StateType => 'pending auto', );
or
my $StateType = $StateObject->StateTypeLookup( StateTypeID => 1, );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.