Base#

NAME#

Kernel::System::ProcessManagement::TransitionValidation::Base - Base Module for Transition Validation Module

DESCRIPTION#

All Base functions.

PUBLIC INTERFACE#

new()#

Don’t use the constructor directly, use the ObjectManager instead:

my $TransitionValidationBaseObject = $Kernel::OM->Get('Kernel::System::ProcessManagement::TransitionValidation::Base');

Validate()#

Validates Data.

my $Match = $TransitionValidationBaseObject->Validate(
    Data => {
        # TicketData
        TicketID          => 1,
        DynamicField_Make => [
           'Test1',
           'Test2',
           'Test3'
        ],
        # [...]
    },
    FieldName    => 'DynamicField_Make',
    'Transition' => {
        'Name'      => 'Transition 2',
        'Condition' => {
            'Type'             => 'and',
            'ConditionLinking' => 'and',
            'Condition 1'      => {
                'Fields' => {
                    'DynamicField_Make' => $VAR1->{'Condition'}
                },
            },
        },
    },
    TransitionName     => 'Transition 2',
    TransitionEntityID => 'T1903007681700000',

    Condition          => {
        Match => 'Test4',
        Type  => 'String',
    },
    ConditionName    => 'Condition 1',
    ConditionType    => 'and',
    ConditionLinking => 'and',
);

Returns:

my $Valid = 1;        # or undef, only returns 1 if Queue is 'Raw'

CheckValueGet()#

Returns the value of field (FieldName, field to be checked) from Data and also uses template generator to replace smart tags.

my $CheckValue = $TransitionValidationBaseObject->CheckValueGet(
    Data       => {
        Queue => 'Raw',
        # ...
    },
    FieldName => 'Queue',
);

Returns:

my $CheckValue = 'Raw';

Smart tags are also supported in simple structure.

my $CheckValue = $TransitionValidationBaseObject->CheckValueGet(
    Data       => {
        Queue => 'Raw',
        DynamicField_Queue => 'Postmaster',
        # ...
    },
    FieldName => '<OTRS_TICKET_DynamicField_Queue>',
);

Returns:

my $CheckValue = 'Postmaster';

Smart tags are also supported in complex structure.

my $CheckValue = $TransitionValidationBaseObject->CheckValueGet(
    Data       => {
        Queue => 'Raw',
        DynamicField_Queue => '<OTRS_TICKET_DynamicField_Junk>',
        DynamicField_Junk => 'Junk',
        # ...
    },
    FieldName => '<OTRS_TICKET_DynamicField_Queue>',
);

Returns:

my $CheckValue = 'Junk';

MatchValueGet()#

Actually the value that must match is stored in Match ($Param{Condition}->{Match}). Since module validations contain the module itself, the value is stored in Value ($Param{Condition}->{Value}). Uses template generator to replace smart tags.

my $MatchValue = $TransitionValidationBaseObject->MatchValueGet(
    Data       => {
        Queue => 'Poster',
        # ...
    },
    MatchValue => 'Raw',
);

Returns:

my $MatchValue = 'Raw';

Smart tags are also supported in simple structure.

my $MatchValue = $TransitionValidationBaseObject->MatchValueGet(
    Data       => {
        Queue => 'Raw',
        DynamicField_Queue => 'Postmaster',
        # ...
    },
    MatchValue => '<OTRS_TICKET_DynamicField_Queue>',
);

Returns:

my $MatchValue = 'Postmaster';

ValueValidate()#

Description.

my $Value = $TransitionValidationBaseObject->ValueValidate(
    Value => 123,
);

Returns:

my $Value = 1;

Equal()#

my $Match = $TransitionValidationBaseObject->Equal(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

NotEqual()#

my $Match = $TransitionValidationBaseObject->NotEqual(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

GreaterThan()#

my $Match = $TransitionValidationBaseObject->GreaterThan(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

LessThan()#

my $Match = $TransitionValidationBaseObject->LessThan(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

GreaterThanOrEqual()#

my $Match = $TransitionValidationBaseObject->GreaterThanOrEqual(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

LessThanOrEqual()#

my $Match = $TransitionValidationBaseObject->LessThanOrEqual(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

Contains()#

my $Match = $TransitionValidationBaseObject->Contains(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;

NotContains()#

my $Match = $TransitionValidationBaseObject->NotContains(
    $CheckValue,
    $MatchValue,
);

Returns:

my $Match = 1;