1# -- 2# Copyright (C) 2001-2020 OTRS AG, https://otrs.com/ 3# -- 4# This software comes with ABSOLUTELY NO WARRANTY. For details, see 5# the enclosed file COPYING for license information (GPL). If you 6# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt. 7# -- 8 9package Kernel::System::SysConfig::ValueType::Entity::State; 10 11use strict; 12use warnings; 13 14use Kernel::System::VariableCheck qw(:all); 15 16use parent qw(Kernel::System::SysConfig::ValueType::Entity); 17 18our @ObjectDependencies = ( 19 'Kernel::System::State', 20 'Kernel::System::Web::Request', 21); 22 23=head1 NAME 24 25Kernel::System::SysConfig::ValueType::Entity::State - System configuration state entity type backend. 26 27=head1 PUBLIC INTERFACE 28 29=head2 new() 30 31Create an object. Do not use it directly, instead use: 32 33 use Kernel::System::ObjectManager; 34 local $Kernel::OM = Kernel::System::ObjectManager->new(); 35 my $EntityTypeObject = $Kernel::OM->Get('Kernel::System::SysConfig::ValueType::Entity::State'); 36 37=cut 38 39sub new { 40 my ( $Type, %Param ) = @_; 41 42 # Allocate new hash for object. 43 my $Self = {}; 44 bless( $Self, $Type ); 45 46 return $Self; 47} 48 49sub EntityValueList { 50 my ( $Self, %Param ) = @_; 51 52 my %States = $Kernel::OM->Get('Kernel::System::State')->StateList( 53 Valid => 1, 54 UserID => 1, 55 ); 56 57 my @Result; 58 59 for my $ID ( sort keys %States ) { 60 push @Result, $States{$ID}; 61 } 62 63 return @Result; 64} 65 66sub EntityLookupFromWebRequest { 67 my ( $Self, %Param ) = @_; 68 69 my $StateID = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'ID' ) // ''; 70 71 return if !$StateID; 72 73 return $Kernel::OM->Get('Kernel::System::State')->StateLookup( StateID => $StateID ); 74} 75 761; 77 78=head1 TERMS AND CONDITIONS 79 80This software is part of the OTRS project (L<https://otrs.org/>). 81 82This software comes with ABSOLUTELY NO WARRANTY. For details, see 83the enclosed file COPYING for license information (GPL). If you 84did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>. 85 86=cut 87