Entity#

NAME#

Kernel::System::SysConfig::ValueType::Entity - System configuration entity value type backed.

PUBLIC INTERFACE#

new()#

Create an object. Do not use it directly, instead use:

use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new();
my $ValueTypeObject = $Kernel::OM->Get('Kernel::System::SysConfig::ValueType::Entity');

SettingEffectiveValueCheck()#

Check if provided EffectiveValue matches structure defined in XMLContentParsed.

my %Result = $ValueTypeObject->SettingEffectiveValueCheck(
    XMLContentParsed => {
        Value => [
            {
                'Item' => [
                    {
                        'Content'            => '3 - normal',
                        'ValueEntityType'    => 'Priority',
                        'ValueEntitySubType' => 'SomeSubType',
                        'ValueType'          => 'Entity',
                    },
                ],
            },
        ],
    },
    EffectiveValue => '2 - low',
);
Result:
$Result = (

EffectiveValue => ‘2 - low’, # Note for Entity ValueTypes EffectiveValue is not changed. Success => 1, Error => undef,

);

EntityValueList()#

Returns a list of valid values for provided EntityType.

my $Result = $ValueTypeObject->EntityValueList(
    EntityType    => 'Priority',
    EntitySubType => 'SomeSubtype',     # optional e.g. the ObjectType for DynamicField entities
);

Returns:

$Result = [
    '1 very low',
    '2 low',
    '3 medium',
    '4 high',
    '5 very high',
];

SettingRender()#

Extracts the effective value from a XML parsed setting.

my $SettingHTML = $ValueTypeObject->SettingRender(
    Name           => 'SettingName',
    EffectiveValue => '3 medium',       # (optional)
    DefaultValue   => '3 medium',       # (optional)
    Class          => 'My class',       # (optional)
    RW             => 1,                # (optional) Allow editing. Default 0.
    Item           => [                 # (optional) XML parsed item
        {
            'ValueType'          => 'Entity',
            'ValueEntityType'    => 'Priority',
            'ValueEntitySubType' => 'SomeSubType',
            'Content'            => '2 low',
        },
    ],
    IsArray => 1,                       # (optional) Item is part of the array
    IsHash  => 1,                       # (optional) Item is part of the hash
    SkipEffectiveValueCheck => 1,       # (optional) If enabled, system will not perform effective value check.
                                        #            Default: 1.
);

Returns:

$SettingHTML = '<div class "Field"...</div>';

AddItem()#

Generate HTML for new array/hash item.

my $HTML = $ValueTypeObject->AddItem(
    Name           => 'SettingName',    (required) Name
    DefaultItem    => {                 (required) DefaultItem hash
        'Content'            => '3 normal',
        'ValueType'          => 'Entity',
        'ValueEntityType'    => 'Priority',
        'ValueEntitySubType' => 'SomeSubType',
    },
    IDSuffix       => '_Array1',        (optional) IDSuffix is needed for arrays and hashes.
);

Returns:

$HTML = '<select class="Modernize" id="SettingName" name="SettingName" title="SettingName">
    # ...
    </select>';

EntityLookupFromWebRequest()#

Gets the entity name from the web request

Called URL: index.pl?Action=AdminQueue;Subaction=Change;QueueID=1

my $EntityName = $ValueTypeObject->EntityLookupFromWebRequest(
    EntityType    => 'Queue',
);

Returns:

$EntityName = 'Postmaster';