Kernel::System::SysConfig::ValueType::DateTime

NAME

Kernel::System::SysConfig::ValueType::DateTime – System configuration date-time 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::DateTime');

SettingEffectiveValueCheck()

Check if provided EffectiveValue matches structure defined in XMLContentParsed.

    my %Result = $ValueTypeObject->SettingEffectiveValueCheck(
        XMLContentParsed => {                                       # (required)
            Value => [
                {
                    'Item' => [
                        {
                            'Content'   => '2016-01-01 00:00:00',
                            'ValueType' => 'DateTime',
                        },
                    ],
                },
            ],
        },
        EffectiveValue => '2016-02-02 01:12:22',                    # (optional)
        UserID         => 1,                                        # (required)
    );

Result: %Result = ( EffectiveValue => '2016-02-02 03:12:22', # Note that EffectiveValue can be modified Success => 1, Error => undef, );

SettingRender()

Extracts the effective value from a XML parsed setting.

    my $SettingHTML = $ValueTypeObject->SettingRender(
        Name           => 'SettingName',
        EffectiveValue => '2016-02-02 01:00:59', # (optional)
        DefaultValue   => 'Product 5',           # (optional)
        Class          => 'My class'             # (optional)
        RW             => 1,                     # (optional) Allow editing. Default 0.
        Item           => [                      # (optional) XML parsed item
            {
                'ValueType' => 'Date',
                'Content' => '2016-02-02 01:00:59',
                'ValueRegex' => '',
            },
        ],
        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.
        UserID                  => 1,       # (required) UserID
    );

Returns:

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

AddItem()

Generate HTML for new array/hash item.

    my $HTML = $ValueTypeObject->AddItem(
        Name           => 'SettingName',    (required) Name
        DefaultItem    => {                 (optional) DefaultItem hash, if available
            Content => '2017-01-01 01:45:00',
            ValueType => 'DateTime',
        },
        IDSuffix       => '_Array1',        (optional) IDSuffix is needed for arrays and hashes.
    );

Returns:

    $HTML = '<select class="Validate_DateMonth  Date" id="SettingName_Array1Month" ...';
Scroll to Top