Skip to content
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
26 changes: 25 additions & 1 deletion Kernel/Modules/AgentTicketProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,30 @@ sub Run {
}
if ( $Self->{Subaction} eq 'DisplayActivityDialog' && $ProcessEntityID ) {

# initial rendering - pre-fill dynamic fields with ticket values
my %Ticket;
if ($TicketID) {
my %Ticket = $TicketObject->TicketGet(
TicketID => $TicketID,
UserID => $Self->{UserID},
DynamicFields => 1,
);
}

DYNAMICFIELD:
for my $DynamicFieldConfig ( values $Self->{DynamicField}->%* ) {
next DYNAMICFIELD unless IsHashRefWithData($DynamicFieldConfig);

# This overwrites the values that might have been taken from the web request.
# Note that there shouldn't be any values from the web request,
# because submits, successful and unsuccessful have been handled already above.
if ( ( $DynamicFieldConfig->{ObjectType} eq 'Ticket' ) && $TicketID ) {

# Value is stored in the database from Ticket.
$GetParam->{DynamicField}{ 'DynamicField_' . $DynamicFieldConfig->{Name} } = $Ticket{ 'DynamicField_' . $DynamicFieldConfig->{Name} };
}
}

return $Self->_OutputActivityDialog(
%Param,
ProcessEntityID => $ProcessEntityID,
Expand Down Expand Up @@ -1867,7 +1891,7 @@ sub _OutputActivityDialog {
CustomerUser => $Param{GetParam}{CustomerUserID} || '',
GetParam => $Param{GetParam},
Autoselect => $Autoselect,
ACLPreselection => $ACLPreselection // '',
ACLPreselection => $ACLPreselection,
LoopProtection => \$LoopProtection,
);

Expand Down
28 changes: 28 additions & 0 deletions Kernel/Modules/CustomerTicketProcess.pm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,34 @@ sub Run {
}
elsif ( $Self->{Subaction} eq 'DisplayActivityDialog' && $ProcessEntityID ) {

# Get values for Ticket fields and use default value for Article fields, if given (this
# screen generates a new article, then article fields will be always default value or
# empty at the beginning).
my %Ticket;
if ($TicketID) {
%Ticket = $Kernel::OM->Get('Kernel::System::Ticket')->TicketGet(
TicketID => $TicketID,
UserID => $Kernel::OM->Get('Kernel::Config')->Get('CustomerPanelUserID'),
DynamicFields => 1,
);
}

DYNAMICFIELD:
for my $DynamicFieldConfig ( values $Self->{DynamicField}->%* ) {
next DYNAMICFIELD if !IsHashRefWithData($DynamicFieldConfig);

# strip dynamic field name from process suffix
if ( $DynamicFieldConfig->{Name} =~ /(?<DFName>[A-Za-z0-9-]+)_/ ) {
my $DFName = $+{DFName};

if ( ( $DynamicFieldConfig->{ObjectType} eq 'Ticket' ) && $TicketID ) {

# Value is stored in the database from Ticket.
$GetParam->{DynamicField}{ 'DynamicField_' . $DFName } = $Ticket{ 'DynamicField_' . $DFName };
}
}
}

return $Self->_OutputActivityDialog(
%Param,
ProcessEntityID => $ProcessEntityID,
Expand Down
Loading