Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #2725 columnfilter #2726

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Kernel/System/DynamicField/Driver/BaseEntity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -775,4 +775,48 @@ sub ValueLookup {
return \@Values;
}

sub ColumnFilterValuesGet {
my ( $Self, %Param ) = @_;

# Extract the information about the dynamic field,
# so that sensible variable names can be used.
my $DynamicField = $Param{DynamicFieldConfig};
my $FieldConfig = $DynamicField->{Config};

# article uses the same routine as ticket
my $ObjectType = $DynamicField->{ObjectType} eq 'Article' ? 'Ticket' : $DynamicField->{ObjectType};

# get column filter values from database
my $ColumnFilterValues = $Kernel::OM->Get("Kernel::System::${ObjectType}::ColumnFilter")->DynamicFieldFilterValuesGet(
%Param,
FieldID => $Param{DynamicFieldConfig}->{ID},
ValueType => $Self->{ValueType},
);

# get the display value if still exist in dynamic field configuration
for my $Key ( sort keys %{$ColumnFilterValues} ) {

my $DisplayValue = $Self->DisplayValueRender(
LayoutObject => $Param{LayoutObject},
Value => $Key,
);

if ( IsHashRefWithData($DisplayValue) ) {
$ColumnFilterValues->{$Key} = $DisplayValue->{Value};
}
}

if ( $FieldConfig->{TranslatableValues} ) {

# translate the value
for my $ValueKey ( sort keys %{$ColumnFilterValues} ) {

my $OriginalValueName = $ColumnFilterValues->{$ValueKey};
$ColumnFilterValues->{$ValueKey} = $Param{LayoutObject}->{LanguageObject}->Translate($OriginalValueName);
}
}

return $ColumnFilterValues;
}

1;
2 changes: 1 addition & 1 deletion Kernel/System/DynamicField/Driver/TicketReference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ sub new {
'IsACLReducible' => 0,
'IsNotificationEventCondition' => 0,
'IsSortable' => 1,
'IsFiltrable' => 0,
'IsFiltrable' => 1,
'IsStatsCondition' => 0,
'IsCustomerInterfaceCapable' => 1,
'IsHiddenInTicketInformation' => 0,
Expand Down
Loading