From b2ae6f27feeaa0a2bddc50571575c7dd9e03a2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=A4rter?= Date: Tue, 23 Jan 2024 14:41:31 +0100 Subject: [PATCH] Issue #2866: Made dynamic field configs dependend upon relevant checks. --- Kernel/Output/HTML/TicketZoom/Agent/Base.pm | 27 ++++++++++++++----- .../HTML/TicketZoom/TicketInformation.pm | 13 +++++---- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Kernel/Output/HTML/TicketZoom/Agent/Base.pm b/Kernel/Output/HTML/TicketZoom/Agent/Base.pm index 92b750ceb0..10fbf9b517 100644 --- a/Kernel/Output/HTML/TicketZoom/Agent/Base.pm +++ b/Kernel/Output/HTML/TicketZoom/Agent/Base.pm @@ -31,6 +31,7 @@ our @ObjectDependencies = ( 'Kernel::System::Encode', 'Kernel::System::Log', 'Kernel::System::SystemAddress', + 'Kernel::System::Ticket', 'Kernel::System::Ticket::Article', 'Kernel::System::User', ); @@ -126,17 +127,29 @@ sub ArticleMetaFields { } } + # check if ticket is normal or process ticket + my $IsProcessTicket = $Kernel::OM->Get('Kernel::System::Ticket')->TicketCheckForProcessType( + TicketID => $Param{TicketID} + ); + + # get zoom settings + my $DisplaySettings = $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom"); + # get dynamic field config for frontend module my $DynamicFieldFilter = { - %{ $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{DynamicField} || {} }, - %{ - $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{DynamicFieldWidgetDynamicField} + %{ $DisplaySettings->{DynamicField} || {} }, + IsHashRefWithData( $DisplaySettings->{DynamicFieldWidgetDisplay} ) + ? %{ + $DisplaySettings->{DynamicFieldWidgetDynamicField} || {} - }, - %{ - $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{ProcessWidgetDynamicField} + } + : (), + $IsProcessTicket + ? %{ + $DisplaySettings->{ProcessWidgetDynamicField} || {} - }, + } + : (), }; # get the dynamic fields for article object diff --git a/Kernel/Output/HTML/TicketZoom/TicketInformation.pm b/Kernel/Output/HTML/TicketZoom/TicketInformation.pm index a865227036..e962c311f2 100644 --- a/Kernel/Output/HTML/TicketZoom/TicketInformation.pm +++ b/Kernel/Output/HTML/TicketZoom/TicketInformation.pm @@ -371,19 +371,22 @@ sub Run { ); } - # TODO order of dynamic field configs here differs from similar places - check why # get dynamic field config for frontend module my $DynamicFieldFilter = { - %{ + IsHashRefWithData( $Self->{DisplaySettings}{DynamicFieldWidgetDisplay} ) + ? %{ $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom") ->{DynamicFieldWidgetDynamicField} || {} - }, - %{ + } + : (), + $IsProcessTicket + ? %{ $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom") ->{ProcessWidgetDynamicField} || {} - }, + } + : (), %{ $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{DynamicField} || {} }, };