Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
Fixed: Improve PDF display of article fields in the customer interfac…
Browse files Browse the repository at this point in the history
…e (Ticket#2020111942002059).
  • Loading branch information
dominikklein committed Dec 7, 2020
1 parent c83de46 commit 0224407
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 6.0.31 ????-??-??
- 2020-12-07 Fixed Ticket#2020111942002059 - Improve PDF display of article fields in the customer interface.

# 6.0.30 2020-10-12
- 2020-09-22 Updated translations, thanks to all translators.
Expand Down
33 changes: 28 additions & 5 deletions Kernel/Output/PDF/Ticket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ use warnings;
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::CommunicationChannel',
'Kernel::System::CustomerUser',
'Kernel::System::DynamicField',
'Kernel::System::DynamicField::Backend',
'Kernel::System::LinkObject',
'Kernel::System::Log',
'Kernel::System::PDF',
'Kernel::System::JSON',
'Kernel::System::PDF',
'Kernel::System::User',
'Kernel::System::CustomerUser',
'Kernel::System::Ticket',
'Kernel::System::Ticket::Article',
'Kernel::System::DynamicField',
'Kernel::System::DynamicField::Backend',
);

use Kernel::System::VariableCheck qw(IsHashRefWithData);
Expand Down Expand Up @@ -1061,6 +1062,9 @@ sub _PDFOutputArticles {
Y => 2,
);

my @CommunicationChannelList = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelList();
my %CommunicationChannels = map { $_->{ChannelID} => $_->{ChannelName} } @CommunicationChannelList;

my %ArticleFields = $LayoutObject->ArticleFields(%Article);

# Display article fields.
Expand All @@ -1076,10 +1080,29 @@ sub _PDFOutputArticles {
next ARTICLE_FIELD if $ArticleField{HideInTicketPrint};
next ARTICLE_FIELD if !$ArticleField{Value};

my $FieldValue = $ArticleField{Value};

if (
$CommunicationChannels{ $Article{CommunicationChannelID} } eq 'Internal'
&& $Article{SenderType} eq 'agent'
&& $Param{Interface}->{Customer}
&& $ArticleFieldKey eq 'From'
)
{

my $DisplayNoteFrom = $ConfigObject->Get('Ticket::Frontend::CustomerTicketZoom')->{DisplayNoteFrom}
|| '';

if ( $DisplayNoteFrom && $DisplayNoteFrom eq 'DefaultAgentName' ) {
$FieldValue = $ConfigObject->Get('Ticket::Frontend::CustomerTicketZoom')->{DefaultAgentName}
|| 'Support Agent';
}
}

$TableParam1{CellData}[$Row][0]{Content}
= $LayoutObject->{LanguageObject}->Translate( $ArticleField{Label} ) . ':';
$TableParam1{CellData}[$Row][0]{Font} = 'ProportionalBold';
$TableParam1{CellData}[$Row][1]{Content} = $ArticleField{Value};
$TableParam1{CellData}[$Row][1]{Content} = $FieldValue;
$Row++;
}

Expand Down

0 comments on commit 0224407

Please sign in to comment.