Skip to content

Commit

Permalink
Issue #2987: Fixed falsely passing param Set to attribute df ValueSet.
Browse files Browse the repository at this point in the history
Improved handling of empty Set values.
  • Loading branch information
stefanhaerter committed Feb 20, 2024
1 parent f540bf4 commit 9ae9f5e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Kernel/System/DynamicField/Driver/Lens.pm
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,15 @@ sub ValueGet {
if ( $Param{Set} ) {
my @Values;
for my $RefID ( $ReferencedObjectID->@* ) {
push @Values, $Kernel::OM->Get('Kernel::System::DynamicField::Backend')->ValueGet(
DynamicFieldConfig => $AttributeDFConfig,
ObjectID => $RefID,
Set => 1,
);
if ( !$RefID ) {
push @Values, undef;
}
else {
push @Values, $Kernel::OM->Get('Kernel::System::DynamicField::Backend')->ValueGet(
DynamicFieldConfig => $AttributeDFConfig,
ObjectID => $RefID,
);
}
}
return \@Values;
}
Expand All @@ -138,6 +142,7 @@ sub ValueSet {

# in set case, we iterate over the values and set them one by one
if ( $Param{Set} ) {
INDEX:
for my $SetIndex ( 0 .. $#{ $Param{Value} } ) {

# with param SetIndex, a single obect id is returned
Expand All @@ -149,7 +154,7 @@ sub ValueSet {
SetIndex => $SetIndex,
);

return unless $ReferencedObjectID;
next INDEX unless $ReferencedObjectID;

my $Success = $Kernel::OM->Get('Kernel::System::DynamicField::Backend')->ValueSet(
%Param,
Expand Down Expand Up @@ -858,6 +863,7 @@ sub _GetReferencedObjectID {
Set => $Param{Set},
);

return $ObjectID->[0] if ref $ObjectID;
return $ObjectID;
}

Expand Down

0 comments on commit 9ae9f5e

Please sign in to comment.