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 #2768: Shift acl hidden class handling to EditFieldRender subs. #2769

Merged
merged 1 commit into from
Dec 14, 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
6 changes: 1 addition & 5 deletions Kernel/Modules/AgentTicketProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2650,6 +2650,7 @@ sub _RenderDynamicField {
ParamObject => $Kernel::OM->Get('Kernel::System::Web::Request'),
AJAXUpdate => 1,
Mandatory => $Param{ActivityDialogField}->{Display} == 2,
ACLHidden => ( $Param{ActivityDialogField}->{Display} == 2 && !$Param{Visibility} ),
UpdatableFields => $Param{AJAXUpdatableFields},
ServerError => $ServerError,
ErrorMessage => $ErrorMessage,
Expand All @@ -2663,11 +2664,6 @@ sub _RenderDynamicField {
HiddenClass => ' oooACLHidden',
HiddenStyle => 'style=display:none;',
);

# ACL hidden fields cannot be mandatory
if ( $Param{ActivityDialogField}{Display} == 2 ) {
$DynamicFieldHTML->{Field} =~ s/(class=.+?Validate_Required)/$1_IfVisible/g;
}
}

my %Data = (
Expand Down
6 changes: 1 addition & 5 deletions Kernel/Modules/CustomerTicketProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,7 @@ sub _RenderDynamicField {
ParamObject => $Kernel::OM->Get('Kernel::System::Web::Request'),
AJAXUpdate => 1,
Mandatory => $Param{ActivityDialogField}->{Display} == 2,
ACLHidden => ( $Param{ActivityDialogField}->{Display} == 2 && !$Param{Visibility} ),
UpdatableFields => $Param{AJAXUpdatableFields},
ServerError => $ServerError,
ErrorMessage => $ErrorMessage,
Expand All @@ -1865,11 +1866,6 @@ sub _RenderDynamicField {
HiddenClass => ' oooACLHidden',
HiddenStyle => 'style=display:none;',
);

# ACL hidden fields cannot be mandatory
if ( $Param{ActivityDialogField}{Display} == 2 ) {
$DynamicFieldHTML->{Field} =~ s/(class=.+?Validate_Required)/$1_IfVisible/g;
}
}

my %Data = (
Expand Down
6 changes: 1 addition & 5 deletions Kernel/Output/HTML/DynamicField/Mask.pm
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ sub EditSectionRender {
)
{
%InvisibleNoDefault = (
ACLHidden => 1,
UseDefaultValue => 0,
OverridePossibleNone => 1,
);
Expand Down Expand Up @@ -256,11 +257,6 @@ sub EditSectionRender {
# hide fields
if ( $Param{Visibility} && !$Param{Visibility}{$DFName} ) {
$CellClassString .= ' oooACLHidden';

# ACL hidden fields cannot be mandatory
if ( $Field->{Mandatory} ) {
$DynamicFieldHTML =~ s/(class=.+?Validate_Required)/$1_IfVisible/g;
}
}

# column placement
Expand Down
1 change: 1 addition & 0 deletions Kernel/System/DynamicField/Backend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ creates the field and label HTML to be used in edit masks.
},
Value => 'Any value', # Optional
Mandatory => 1, # 0 or 1,
ACLHidden => 1, # 0 or 1,
Class => 'AnyCSSClass OrOneMore', # Optional
ServerError => 1, # 0 or 1,
ErrorMessage => $ErrorMessage, # Optional or a default will be used in error case
Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseDatabase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseDateTime.pm
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseEntity.pm
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseReference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseScript.pm
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseSelect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/BaseText.pm
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/Checkbox.pm
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/ContactWD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/Date.pm
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/Multiselect.pm
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/RichText.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
8 changes: 6 additions & 2 deletions Kernel/System/DynamicField/Driver/Set.pm
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,12 @@ sub EditFieldRender {
}

# TODO: maybe set all mandatory? necessary?
# # set field as mandatory
# if ( $Param{Mandatory} ) {
# # set classes according to mandatory and acl hidden params
# if ( $Param{ACLHidden} && $Param{Mandatory} ) {
# $FieldClass .= ' Validate_Required_IfVisible';
# }
# elsif ( $Param{Mandatory} ) {
# $FieldClass .= ' Validate_Required';
# }

# TODO:
Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/TextArea.pm
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
7 changes: 5 additions & 2 deletions Kernel/System/DynamicField/Driver/WebService.pm
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ sub EditFieldRender {
$FieldClass .= ' ' . $Param{Class};
}

# set field as mandatory
if ( $Param{Mandatory} ) {
# set classes according to mandatory and acl hidden params
if ( $Param{ACLHidden} && $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required_IfVisible';
}
elsif ( $Param{Mandatory} ) {
$FieldClass .= ' Validate_Required';
}

Expand Down
Loading