Skip to content

Commit

Permalink
Issue #4146: Implemented regexp handling when cloning a dynamic field…
Browse files Browse the repository at this point in the history
… text.
  • Loading branch information
stefanhaerter authored and svenoe committed Feb 20, 2025
1 parent 8875c64 commit b96a835
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Kernel/Modules/AdminDynamicFieldText.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,61 @@ sub _ShowScreen {
}

}
elsif ( $Param{CloneFieldID} && IsArrayRefWithData( $Param{RegExList} ) ) {

if ( !$Param{RegExCounter} ) {

my $RegExCounter = 0;
for my $RegEx ( @{ $Param{RegExList} } ) {

$RegExCounter++;
$Param{ 'RegEx_' . $RegExCounter } = $RegEx->{Value};
$Param{ 'CustomerRegExErrorMessage_' . $RegExCounter } = $RegEx->{ErrorMessage};
}

$Param{RegExCounter} = $RegExCounter;
}

# NOTE check is necessary because previous block potentially alters $Param{RegExCounter}
if ( $Param{RegExCounter} ) {

REGEXENTRY:
for my $CurrentRegExEntryID ( 1 .. $Param{RegExCounter} ) {

# check existing regex
next REGEXENTRY if !$Param{ 'RegEx_' . $CurrentRegExEntryID };

$LayoutObject->Block(
Name => 'RegExRow',
Data => {
EntryCounter => $CurrentRegExEntryID,
RegEx => $Param{ 'RegEx_' . $CurrentRegExEntryID },
RegExServerError =>
$Param{ 'RegEx_' . $CurrentRegExEntryID . 'ServerError' }
|| '',
RegExServerErrorMessage =>
$Param{ 'RegEx_' . $CurrentRegExEntryID . 'ServerErrorMessage' } || '',
CustomerRegExErrorMessage =>
$Param{ 'CustomerRegExErrorMessage_' . $CurrentRegExEntryID },
CustomerRegExErrorMessageServerError =>
$Param{
'CustomerRegExErrorMessage_'
. $CurrentRegExEntryID
. 'ServerError'
}
|| '',
CustomerRegExErrorMessageServerErrorMessage =>
$Param{
'CustomerRegExErrorMessage_'
. $CurrentRegExEntryID
. 'ServerErrorMessage'
}
|| '',
}
);
}
}
}

my $FilterStrg = '';
if ( IsStringWithData( $Param{ObjectTypeFilter} ) ) {
Expand Down

0 comments on commit b96a835

Please sign in to comment.