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::Type;
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::Type',
20    'Kernel::System::Web::Request',
21);
22
23=head1 NAME
24
25Kernel::System::SysConfig::ValueType::Entity::Type - System configuration ticket type 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::Type');
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 %Types = $Kernel::OM->Get('Kernel::System::Type')->TypeList(
53        Valid => 1,
54    );
55
56    my @Result;
57
58    for my $ID ( sort keys %Types ) {
59        push @Result, $Types{$ID};
60    }
61
62    return @Result;
63}
64
65sub EntityLookupFromWebRequest {
66    my ( $Self, %Param ) = @_;
67
68    my $TypeID = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'ID' ) // '';
69
70    return if !$TypeID;
71
72    return $Kernel::OM->Get('Kernel::System::Type')->TypeLookup( TypeID => $TypeID );
73}
74
751;
76
77=head1 TERMS AND CONDITIONS
78
79This software is part of the OTRS project (L<https://otrs.org/>).
80
81This software comes with ABSOLUTELY NO WARRANTY. For details, see
82the enclosed file COPYING for license information (GPL). If you
83did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
84
85=cut
86