Skip to content

Commit

Permalink
Fixed dynamic field smart tag support for snippets.
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasSchmitt committed Mar 22, 2024
1 parent 25b8128 commit 252d0af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 6.5.7 2024-??-??
- 2024-03-22 Fixed dynamic field smart tag support for snippets. [#537](https://github.com/znuny/Znuny/issues/537)
- 2024-03-13 Fixed usage of sysconfig setting `Ticket::Frontend::Overview::PreviewArticleSenderTypes`. [#542](https://github.com/znuny/Znuny/issues/542)
- 2024-03-04 Hide mentions widget on ticket zoom when no mentions are available.
- 2024-02-29 Hide unknown content-type on article attachments.
Expand Down
15 changes: 12 additions & 3 deletions Kernel/System/Autocompletion/Template.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ package Kernel::System::Autocompletion::Template;

use strict;
use warnings;
use utf8;

use Kernel::System::VariableCheck qw(:all);

use parent qw(Kernel::System::Autocompletion::Base);

our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Log',
'Kernel::System::Queue',
'Kernel::System::StandardTemplate',
Expand Down Expand Up @@ -53,6 +55,7 @@ our @ObjectDependencies = (
sub GetData {
my ( $Self, %Param ) = @_;

my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $LogObject = $Kernel::OM->Get('Kernel::System::Log');
my $QueueObject = $Kernel::OM->Get('Kernel::System::Queue');
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
Expand All @@ -77,6 +80,7 @@ sub GetData {
return if !IsArrayRefWithData($SearchFields);

my $AdditionalParams = $Param{AdditionalParams} // {};
my $RichText = $ConfigObject->Get('Frontend::RichText');

#
# Get list of relevant standard templates to fetch autocompletion information for.
Expand All @@ -92,8 +96,10 @@ sub GetData {
}
elsif ( $AdditionalParams->{TicketID} ) {
%Ticket = $TicketObject->TicketGet(
TicketID => $AdditionalParams->{TicketID},
UserID => $Param{UserID} // 1,
TicketID => $AdditionalParams->{TicketID},
UserID => $Param{UserID},
DynamicFields => 1,
Silent => 1,
);
return if !%Ticket;

Expand All @@ -119,14 +125,17 @@ sub GetData {
keys %StandardTemplates
)
{
# Skip template with ID 0.
next STANDARDTEMPLATEID if $StandardTemplateID == 0;

my %StandardTemplate = $StandardTemplateObject->StandardTemplateGet(
ID => $StandardTemplateID,
);
next STANDARDTEMPLATEID if !%StandardTemplate;

# Replace template tags/placeholders.
$StandardTemplate{Template} = $TemplateGeneratorObject->_Replace(
RichText => $StandardTemplate{Template},
RichText => $RichText,
Text => $StandardTemplate{Template},
TicketData => \%Ticket,
Data => {},
Expand Down

0 comments on commit 252d0af

Please sign in to comment.