Skip to content

Commit

Permalink
Issue #2637: Introduced behavior 'IsDropdownCapable' for reference fi…
Browse files Browse the repository at this point in the history
…elds.

Introduced 'ConstantValue' for field type settings.
Both to restrict CustomerUser input type to autocomplete while maintaining field type settings structure.
  • Loading branch information
stefanhaerter committed Dec 12, 2023
1 parent 8fdf7b3 commit b575906
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
18 changes: 16 additions & 2 deletions Kernel/Modules/AdminDynamicFieldReference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,18 @@ sub _AddAction {
SETTING:
for my $Setting ( $Param{FieldTypeSettings}->@* ) {

my $Name = $Setting->{ConfigParamName};

# handle settings with a constant value
if ( $Setting->{ConstantValue} ) {
$FieldConfig{$Name} = $Setting->{ConstantValue};
next SETTING;
}

# skip custom inputs which are handled separately
# currently only used for reference filter list
next SETTING if !$Setting->{InputType};

my $Name = $Setting->{ConfigParamName};
$FieldConfig{$Name} = $GetParam{$Name};
}

Expand Down Expand Up @@ -624,11 +631,18 @@ sub _ChangeAction {
SETTING:
for my $Setting ( $Param{FieldTypeSettings}->@* ) {

my $Name = $Setting->{ConfigParamName};

# handle settings with a constant value
if ( $Setting->{ConstantValue} ) {
$FieldConfig{$Name} = $Setting->{ConstantValue};
next SETTING;
}

# skip custom inputs which are handled separately
# currently only used for reference filter list
next SETTING if !$Setting->{InputType};

my $Name = $Setting->{ConfigParamName};
$FieldConfig{$Name} = $GetParam{$Name};
}

Expand Down
1 change: 1 addition & 0 deletions Kernel/System/DynamicField/Driver/Agent.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ sub new {
'IsCustomerInterfaceCapable' => 1,
'IsHiddenInTicketInformation' => 0,
'IsReferenceField' => 1,
'IsDropdownCapable' => 1,
};

$Self->{ReferencedObjectType} = 'Agent';
Expand Down
9 changes: 4 additions & 5 deletions Kernel/System/DynamicField/Driver/BaseReference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,9 @@ sub GetFieldTypeSettings {
};
}

# set up the edit field mode selection
{
if ( $Self->{Behaviors}{IsDropdownCapable} ) {

# set up the edit field mode selection
push @GenericSettings,
{
ConfigParamName => 'EditFieldMode',
Expand All @@ -866,10 +867,8 @@ sub GetFieldTypeSettings {
},
PossibleNone => 0,
};
}

# add possible none option
{
# add possible none option
push @GenericSettings,
{
ConfigParamName => 'PossibleNone',
Expand Down
1 change: 1 addition & 0 deletions Kernel/System/DynamicField/Driver/CustomerCompany.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ sub new {
'IsCustomerInterfaceCapable' => 1,
'IsHiddenInTicketInformation' => 0,
'IsReferenceField' => 1,
'IsDropdownCapable' => 1,
};

$Self->{ReferencedObjectType} = 'CustomerCompany';
Expand Down
8 changes: 8 additions & 0 deletions Kernel/System/DynamicField/Driver/CustomerUser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ sub new {
'IsCustomerInterfaceCapable' => 1,
'IsHiddenInTicketInformation' => 0,
'IsReferenceField' => 1,
'IsDropdownCapable' => 0,
};

$Self->{ReferencedObjectType} = 'CustomerUser';
Expand All @@ -103,6 +104,13 @@ sub GetFieldTypeSettings {
%Param,
);

# always set editfieldmode to autocomplete
push @FieldTypeSettings,
{
ConfigParamName => 'EditFieldMode',
ConstantValue => 'AutoComplete',
};

# Support reference filters
push @FieldTypeSettings,
{
Expand Down
1 change: 1 addition & 0 deletions Kernel/System/DynamicField/Driver/Ticket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ sub new {
'IsCustomerInterfaceCapable' => 1,
'IsHiddenInTicketInformation' => 0,
'IsReferenceField' => 1,
'IsDropdownCapable' => 1,
};

$Self->{ReferencedObjectType} = 'Ticket';
Expand Down

0 comments on commit b575906

Please sign in to comment.