112 lines
3.0 KiB
Perl
112 lines
3.0 KiB
Perl
# --
|
|
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
|
# --
|
|
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
|
# the enclosed file COPYING for license information (GPL). If you
|
|
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
|
# --
|
|
|
|
package Kernel::System::DynamicField::Driver::Text;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use Kernel::System::VariableCheck qw(:all);
|
|
|
|
use parent qw(Kernel::System::DynamicField::Driver::BaseText);
|
|
|
|
our @ObjectDependencies = (
|
|
'Kernel::Config',
|
|
'Kernel::System::DynamicFieldValue',
|
|
'Kernel::System::Main',
|
|
);
|
|
|
|
=head1 NAME
|
|
|
|
Kernel::System::DynamicField::Driver::Text
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
DynamicFields Text Driver delegate
|
|
|
|
=head1 PUBLIC INTERFACE
|
|
|
|
This module implements the public interface of L<Kernel::System::DynamicField::Backend>.
|
|
Please look there for a detailed reference of the functions.
|
|
|
|
=head2 new()
|
|
|
|
usually, you want to create an instance of this
|
|
by using Kernel::System::DynamicField::Backend->new();
|
|
|
|
=cut
|
|
|
|
sub new {
|
|
my ( $Type, %Param ) = @_;
|
|
|
|
# allocate new hash for object
|
|
my $Self = {};
|
|
bless( $Self, $Type );
|
|
|
|
# set field behaviors
|
|
$Self->{Behaviors} = {
|
|
'IsACLReducible' => 0,
|
|
'IsNotificationEventCondition' => 1,
|
|
'IsSortable' => 1,
|
|
'IsFiltrable' => 0,
|
|
'IsStatsCondition' => 1,
|
|
'IsCustomerInterfaceCapable' => 1,
|
|
'IsLikeOperatorCapable' => 1,
|
|
};
|
|
|
|
# get the Dynamic Field Backend custom extensions
|
|
my $DynamicFieldDriverExtensions
|
|
= $Kernel::OM->Get('Kernel::Config')->Get('DynamicFields::Extension::Driver::Text');
|
|
|
|
EXTENSION:
|
|
for my $ExtensionKey ( sort keys %{$DynamicFieldDriverExtensions} ) {
|
|
|
|
# skip invalid extensions
|
|
next EXTENSION if !IsHashRefWithData( $DynamicFieldDriverExtensions->{$ExtensionKey} );
|
|
|
|
# create a extension config shortcut
|
|
my $Extension = $DynamicFieldDriverExtensions->{$ExtensionKey};
|
|
|
|
# check if extension has a new module
|
|
if ( $Extension->{Module} ) {
|
|
|
|
# check if module can be loaded
|
|
if (
|
|
!$Kernel::OM->Get('Kernel::System::Main')->RequireBaseClass( $Extension->{Module} )
|
|
)
|
|
{
|
|
die "Can't load dynamic fields backend module"
|
|
. " $Extension->{Module}! $@";
|
|
}
|
|
}
|
|
|
|
# check if extension contains more behaviors
|
|
if ( IsHashRefWithData( $Extension->{Behaviors} ) ) {
|
|
|
|
%{ $Self->{Behaviors} } = (
|
|
%{ $Self->{Behaviors} },
|
|
%{ $Extension->{Behaviors} }
|
|
);
|
|
}
|
|
}
|
|
|
|
return $Self;
|
|
}
|
|
|
|
1;
|
|
|
|
=head1 TERMS AND CONDITIONS
|
|
|
|
This software is part of the OTRS project (L<https://otrs.org/>).
|
|
|
|
This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
|
the enclosed file COPYING for license information (GPL). If you
|
|
did not receive this file, see L<https://www.gnu.org/licenses/gpl-3.0.txt>.
|
|
|
|
=cut
|