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 #2507 df label proposal #2508

Open
wants to merge 3 commits into
base: rel-11_0
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion Kernel/Modules/AgentTicketProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2671,7 +2671,6 @@ sub _RenderDynamicField {

my %Data = (
Name => $DynamicFieldConfig->{Name},
Label => $DynamicFieldHTML->{Label},
%Hidden,
);

Expand All @@ -2690,6 +2689,7 @@ sub _RenderDynamicField {
for my $MultiValueIndex ( 0 .. $#{ $DynamicFieldHTML->{MultiValue} } ) {

$Data{Content} = $DynamicFieldHTML->{MultiValue}[$MultiValueIndex];
$Data{Label} = $DynamicFieldHTML->{Label}[$MultiValueIndex];
$LayoutObject->Block(
Name => $Param{ActivityDialogField}->{LayoutBlock} || 'rw:DynamicField',
Data => {
Expand Down Expand Up @@ -2750,6 +2750,7 @@ sub _RenderDynamicField {
}
else {
$Data{Content} = $DynamicFieldHTML->{Field};
$Data{Label} = $DynamicFieldHTML->{Label};

$LayoutObject->Block(
Name => $Param{ActivityDialogField}->{LayoutBlock} || 'rw:DynamicField',
Expand Down
3 changes: 2 additions & 1 deletion Kernel/Modules/CustomerTicketProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,6 @@ sub _RenderDynamicField {

my %Data = (
Name => $DynamicFieldConfig->{Name},
Label => $DynamicFieldHTML->{Label},
%Hidden,
);

Expand All @@ -1892,6 +1891,7 @@ sub _RenderDynamicField {
for my $MultiValueIndex ( 0 .. $#{ $DynamicFieldHTML->{MultiValue} } ) {

$Data{Content} = $DynamicFieldHTML->{MultiValue}[$MultiValueIndex];
$Data{Label} = $DynamicFieldHTML->{Label}[$MultiValueIndex];
$LayoutObject->Block(
Name => $Param{ActivityDialogField}->{LayoutBlock} || 'rw:DynamicField',
Data => {
Expand Down Expand Up @@ -1952,6 +1952,7 @@ sub _RenderDynamicField {
}
else {
$Data{Content} = $DynamicFieldHTML->{Field};
$Data{Label} = $DynamicFieldHTML->{Label};

$LayoutObject->Block(
Name => $Param{ActivityDialogField}->{LayoutBlock} || 'rw:DynamicField',
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Output/HTML/DynamicField/Mask.pm
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ sub EditSectionRender {
Name => $ColBlockName,
Data => {
%CellBlockData,
Label => $DynamicFieldHTML->{Label}, # TODO: fix the numbering of 'id' and 'for'
Label => $DynamicFieldHTML->{Label}[$ValueRowIndex],
Field => $DynamicFieldHTML->{MultiValue}[$ValueRowIndex],
Index => $ValueRowIndex,
CellClasses => $CellClassString . ' MultiValue_' . $ValueRowIndex,
Expand All @@ -307,7 +307,7 @@ sub EditSectionRender {
Name => 'Template' . $ColBlockName,
Data => {
%CellBlockData,
Label => $DynamicFieldHTML->{Label}, # TODO: fix the numbering of 'id' and 'for'
Label => $DynamicFieldHTML->{LabelTemplate},
Field => $DynamicFieldHTML->{MultiValueTemplate},
}
};
Expand Down
30 changes: 20 additions & 10 deletions Kernel/System/DynamicField/Driver/BaseDatabase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ sub EditFieldRender {
Mandatory => $Param{Mandatory},
);
my @ResultHTML;
my @ResultLabels;
for my $ValueIndex ( 0 .. $#{$Value} ) {
$FieldTemplateData{FieldID} = $FieldConfig->{MultiValue} ? $FieldName . '_' . $ValueIndex : $FieldName;

Expand All @@ -406,9 +407,17 @@ sub EditFieldRender {
Value => $Value->[$ValueIndex],
},
);

# call EditLabelRender on the common Driver
push @ResultLabels, $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldTemplateData{FieldID},
);
}

my $TemplateHTML;
my $TemplateLabel;
if ( $FieldConfig->{MultiValue} && !$Param{Readonly} ) {
$FieldTemplateData{FieldID} = $FieldName . '_Template';

Expand All @@ -418,31 +427,32 @@ sub EditFieldRender {
%FieldTemplateData,
},
);

# call EditLabelRender on the common Driver
$TemplateLabel = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldTemplateData{FieldID},
);
}

$Param{LayoutObject}->AddJSData(
Key => 'ActiveAutoComplete',
Value => $ActiveAutoComplete,
);

# call EditLabelRender on the common Driver
my $LabelString = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldConfig->{MultiValue} ? $FieldName . '_0' : $FieldName,
);

my $Data = {
Label => $LabelString,
};
my $Data;

# decide which structure to return
if ( $FieldConfig->{MultiValue} ) {
$Data->{MultiValue} = \@ResultHTML;
$Data->{Label} = \@ResultLabels;
$Data->{MultiValueTemplate} = $TemplateHTML;
$Data->{LabelTemplate} = $TemplateLabel;
}
else {
$Data->{Field} = $ResultHTML[0];
$Data->{Field} = $ResultLabels[0];
}

return $Data;
Expand Down
30 changes: 20 additions & 10 deletions Kernel/System/DynamicField/Driver/BaseDateTime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ sub EditFieldRender {
Mandatory => $Param{Mandatory},
);
my @ResultHTML;
my @ResultLabels;
for my $ValueIndex ( 0 .. $#ValueParts ) {

my $Suffix = $FieldConfig->{MultiValue} ? "_$ValueIndex" : '';
Expand Down Expand Up @@ -347,9 +348,17 @@ sub EditFieldRender {
DateSelectionHTML => $DateSelectionHTML,
},
);

# call EditLabelRender on the common Driver
push @ResultLabels, $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldName . 'Used',
);
}

my $TemplateHTML;
my $TemplateLabel;
if ( $FieldConfig->{MultiValue} && !$Param{Readonly} ) {

$FieldTemplateData{DivID} = $FieldName . '_Template';
Expand Down Expand Up @@ -377,27 +386,28 @@ sub EditFieldRender {
DateSelectionHTML => $DateSelectionHTML,
},
);

# call EditLabelRender on the common Driver
$TemplateLabel = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldName . '_TemplateUsed',
);
}

# We do not rewrite Validate_DateYear etc. to Validate_DateYear_IfVisible as one valid option is always selected

# call EditLabelRender on the common Driver
my $LabelString = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => ( $FieldConfig->{MultiValue} ? $FieldName . '_0' : $FieldName ) . 'Used',
);

my $Data = {
Label => $LabelString,
};
my $Data;

if ( $FieldConfig->{MultiValue} ) {
$Data->{MultiValue} = \@ResultHTML;
$Data->{Label} = \@ResultLabels;
$Data->{MultiValueTemplate} = $TemplateHTML;
$Data->{LabelTemplate} = $TemplateLabel;
}
else {
$Data->{Field} = $ResultHTML[0];
$Data->{Label} = $ResultLabels[0];
}

return $Data;
Expand Down
31 changes: 20 additions & 11 deletions Kernel/System/DynamicField/Driver/BaseEntity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ sub EditFieldRender {
Mandatory => $Param{Mandatory},
);
my @ResultHTML;
my @ResultLabels;
for my $ValueIndex ( 0 .. $#{$Value} ) {
$FieldTemplateData{FieldID} = $FieldConfig->{MultiValue} ? $FieldName . '_' . $ValueIndex : $FieldName;

Expand All @@ -330,9 +331,17 @@ sub EditFieldRender {
SelectionHTML => $SelectionHTML[$ValueIndex],
},
);

# call EditLabelRender on the common Driver
push @ResultLabels, $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldTemplateData{FieldID},
);
}

my $TemplateHTML;
my $TemplateLabel;
if ( $FieldConfig->{MultiValue} && !$Param{Readonly} ) {
$FieldTemplateData{FieldID} = $FieldName . '_Template';

Expand All @@ -353,6 +362,13 @@ sub EditFieldRender {
SelectionHTML => $SelectionHTML,
},
);

# call EditLabelRender on the common Driver
$TemplateLabel = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldTemplateData{FieldID},
);
}

if ( $Param{AJAXUpdate} ) {
Expand All @@ -377,25 +393,18 @@ sub EditFieldRender {
EOF
}

# call EditLabelRender on the common Driver
# only a single label is returned, even for MultiValue fields
my $LabelString = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldConfig->{MultiValue} ? $FieldName . '_0' : $FieldName,
);

my $Data = {
Label => $LabelString,
};
my $Data;

# decide which structure to return
if ( $FieldConfig->{MultiValue} ) {
$Data->{MultiValue} = \@ResultHTML;
$Data->{Label} = \@ResultLabels;
$Data->{MultiValueTemplate} = $TemplateHTML;
$Data->{LabelTemplate} = $TemplateLabel;
}
else {
$Data->{Field} = $ResultHTML[0];
$Data->{Label} = $ResultLabels[0];
}

return $Data;
Expand Down
30 changes: 20 additions & 10 deletions Kernel/System/DynamicField/Driver/BaseReference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ sub EditFieldRender {
Mandatory => $Param{Mandatory},
);
my @ResultHTML;
my @ResultLabels;
for my $ValueIndex ( 0 .. ( $DFDetails->{Multiselect} ? 0 : $#{$Value} ) ) {
my $FieldID = $DFDetails->{MultiValue} ? $FieldName . '_' . $ValueIndex : $FieldName;

Expand Down Expand Up @@ -339,9 +340,17 @@ sub EditFieldRender {
SelectionHTML => ( $DFDetails->{EditFieldMode} ne 'AutoComplete' ? $SelectionHTML[$ValueIndex] : undef ),
},
);

# call EditLabelRender on the common Driver
push @ResultLabels, $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldID,
);
}

my $TemplateHTML;
my $TemplateLabel;
if ( $DFDetails->{MultiValue} && !$Param{Readonly} ) {
$FieldTemplateData{FieldID} = $FieldName . '_Template';

Expand All @@ -363,6 +372,13 @@ sub EditFieldRender {
SelectionHTML => ( $DFDetails->{EditFieldMode} ne 'AutoComplete' ? $SelectionHTML : undef ),
},
);

# call EditLabelRender on the common Driver
$TemplateLabel = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $FieldTemplateData{FieldID},
);
}

if ( $Param{AJAXUpdate} ) {
Expand Down Expand Up @@ -390,24 +406,18 @@ Core.App.Subscribe('Event.AJAX.FormUpdate.Callback', function(Data) {
EOF
}

# call EditLabelRender on the common Driver
my $LabelString = $Self->EditLabelRender(
%Param,
Mandatory => $Param{Mandatory} || '0',
FieldName => $DFDetails->{MultiValue} ? "${FieldName}_0" : $FieldName,
);

my %Data = (
Label => $LabelString,
);
my %Data;

# decide which structure to return
if ( $DFDetails->{MultiValue} ) {
$Data{MultiValue} = \@ResultHTML;
$Data{Label} = \@ResultLabels;
$Data{MultiValueTemplate} = $TemplateHTML;
$Data{LabelTemplate} = $TemplateLabel;
}
else {
$Data{Field} = $ResultHTML[0];
$Data{Label} = $ResultLabels[0];
}

return \%Data;
Expand Down
Loading
Loading