Skip to content

Commit

Permalink
Issue #2648: Corrected handling of value reducing for DFs date and mu…
Browse files Browse the repository at this point in the history
…ltiselect.
  • Loading branch information
stefanhaerter committed Nov 9, 2023
1 parent 8394870 commit e74282b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 31 deletions.
5 changes: 0 additions & 5 deletions Kernel/System/DynamicField/Driver/BaseDateTime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -697,14 +697,10 @@ sub DisplayValueRender {
if ($HTMLOutput) {
$Title = $Param{LayoutObject}->Ascii2Html(
Text => $Title,
Max => $Param{TitleMaxChars} || '',
);
$ValueSeparator = '<br/>';
}
else {
if ( $Param{TitleMaxChars} && length($Title) > $Param{TitleMaxChars} ) {
$Title = substr( $Title, 0, $Param{TitleMaxChars} ) . '...';
}
$ValueSeparator = "\n";
}

Expand All @@ -723,7 +719,6 @@ sub DisplayValueRender {

sub SearchFieldRender {
my ( $Self, %Param ) = @_;
print STDERR "BaseDateTime.pm, L. 715: SearchFieldRender was called\n";

# take config from field config
my $FieldConfig = $Param{DynamicFieldConfig}->{Config};
Expand Down
4 changes: 0 additions & 4 deletions Kernel/System/DynamicField/Driver/Date.pm
Original file line number Diff line number Diff line change
Expand Up @@ -786,14 +786,10 @@ sub DisplayValueRender {
if ($HTMLOutput) {
$Title = $Param{LayoutObject}->Ascii2Html(
Text => $Title,
Max => $Param{TitleMaxChars} || '',
);
$ValueSeparator = '<br/>';
}
else {
if ( $Param{TitleMaxChars} && length($Title) > $Param{TitleMaxChars} ) {
$Title = substr( $Title, 0, $Param{TitleMaxChars} ) . '...';
}
$ValueSeparator = "\n";
}

Expand Down
47 changes: 25 additions & 22 deletions Kernel/System/DynamicField/Driver/Multiselect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -586,26 +586,6 @@ sub DisplayValueRender {
# set title as value after update and before limit
$TitleItem = $ValueItem;

# HTML Output transformation
if ($HTMLOutput) {
$ValueItem = $Param{LayoutObject}->Ascii2Html(
Text => $ValueItem,
Max => $Param{ValueMaxChars},
);
$TitleItem = $Param{LayoutObject}->Ascii2Html(
Text => $TitleItem,
Max => $Param{TitleMaxChars},
);
}
else {
if ( $Param{ValueMaxChars} && length($ValueItem) > $Param{ValueMaxChars} ) {
$ValueItem = substr( $ValueItem, 0, $Param{ValueMaxChars} ) . '...';
}
if ( $Param{TitleMaxChars} && length($TitleItem) > $Param{TitleMaxChars} ) {
$TitleItem = substr( $TitleItem, 0, $Param{TitleMaxChars} ) . '...';
}
}

push @ReadableValues, $ValueItem;
push @ReadableTitles, $TitleItem;
}
Expand All @@ -615,13 +595,36 @@ sub DisplayValueRender {

my $ItemSeparator = $FieldConfig->{ItemSeparator} || ', ';

my $ReadableValue = '' . join( $ItemSeparator, @ReadableValues );
my $ReadableTitle = '' . join( $ItemSeparator, @ReadableTitles );

# HTML Output transformation
if ($HTMLOutput) {
$ReadableValue = $Param{LayoutObject}->Ascii2Html(
Text => $ReadableValue,
Max => $Param{ValueMaxChars},
);
$ReadableTitle = $Param{LayoutObject}->Ascii2Html(
Text => $ReadableTitle,
Max => $Param{TitleMaxChars},
);
}
else {
if ( $Param{ValueMaxChars} && length($ReadableValue) > $Param{ValueMaxChars} ) {
$ReadableValue = substr( $ReadableValue, 0, $Param{ValueMaxChars} ) . '...';
}
if ( $Param{TitleMaxChars} && length($ReadableTitle) > $Param{TitleMaxChars} ) {
$ReadableTitle = substr( $ReadableTitle, 0, $Param{TitleMaxChars} ) . '...';
}
}

# this field type does not support the Link Feature
my $Link;

# return a data structure
return {
Value => '' . join( $ItemSeparator, @ReadableValues ),
Title => '' . join( $ItemSeparator, @ReadableTitles ),
Value => $ReadableValue,
Title => $ReadableTitle,
Link => $Link,
};
}
Expand Down

0 comments on commit e74282b

Please sign in to comment.