init III
This commit is contained in:
341
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Base.pm
Normal file
341
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Base.pm
Normal file
@@ -0,0 +1,341 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::Base;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsHashRefWithData);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::DynamicField',
|
||||
'Kernel::System::DynamicField::Backend',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::SystemAddress',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::System::User',
|
||||
);
|
||||
|
||||
sub new {
|
||||
my ( $Type, %Param ) = @_;
|
||||
|
||||
# allocate new hash for object
|
||||
my $Self = {};
|
||||
bless( $Self, $Type );
|
||||
|
||||
return $Self;
|
||||
}
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article html.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
ShowBrowserLinkMessage => 1, # (optional) Default: 0.
|
||||
ArticleActions => [], # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
die 'Virtual method in base class must not be called.';
|
||||
}
|
||||
|
||||
=head2 ArticleMetaFields()
|
||||
|
||||
Returns common fields for any article.
|
||||
|
||||
my %ArticleMetaFields = $ArticleBaseObject->ArticleMetaFields(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
);
|
||||
|
||||
Returns:
|
||||
|
||||
%ArticleMetaFields = (
|
||||
DynamicField_Item => {
|
||||
Label => 'Item', # mandatory
|
||||
Value => 'Value', # mandatory
|
||||
Link => 'http://...', # optional
|
||||
},
|
||||
AccountedTime => {
|
||||
...
|
||||
},
|
||||
);
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleMetaFields {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $ArticleObject = $Kernel::OM->Get('Kernel::System::Ticket::Article');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
my %Result;
|
||||
|
||||
# show accounted article time
|
||||
if (
|
||||
$ConfigObject->Get('Ticket::ZoomTimeDisplay')
|
||||
&& $ConfigObject->Get('Ticket::Frontend::AccountTime')
|
||||
)
|
||||
{
|
||||
my $ArticleTime = $ArticleObject->ArticleAccountedTimeGet(
|
||||
ArticleID => $Param{ArticleID},
|
||||
);
|
||||
if ($ArticleTime) {
|
||||
$Result{Time} = {
|
||||
Label => "Time",
|
||||
Value => $ArticleTime,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# get dynamic field config for frontend module
|
||||
my $DynamicFieldFilter = {
|
||||
%{ $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{DynamicField} || {} },
|
||||
%{
|
||||
$ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{ProcessWidgetDynamicField}
|
||||
|| {}
|
||||
},
|
||||
};
|
||||
|
||||
# get the dynamic fields for article object
|
||||
my $DynamicField = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldListGet(
|
||||
Valid => 1,
|
||||
ObjectType => ['Article'],
|
||||
FieldFilter => $DynamicFieldFilter || {},
|
||||
);
|
||||
my $DynamicFieldBackendObject = $Kernel::OM->Get('Kernel::System::DynamicField::Backend');
|
||||
|
||||
# cycle trough the activated Dynamic Fields
|
||||
DYNAMICFIELD:
|
||||
for my $DynamicFieldConfig ( @{$DynamicField} ) {
|
||||
next DYNAMICFIELD if !IsHashRefWithData($DynamicFieldConfig);
|
||||
|
||||
my $Value = $DynamicFieldBackendObject->ValueGet(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
ObjectID => $Param{ArticleID},
|
||||
);
|
||||
|
||||
next DYNAMICFIELD if !$Value;
|
||||
next DYNAMICFIELD if $Value eq '';
|
||||
|
||||
# get print string for this dynamic field
|
||||
my $ValueStrg = $DynamicFieldBackendObject->DisplayValueRender(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
Value => $Value,
|
||||
ValueMaxChars => $ConfigObject->Get('Ticket::Frontend::DynamicFieldsZoomMaxSizeArticle')
|
||||
|| 160, # limit for article display
|
||||
LayoutObject => $LayoutObject,
|
||||
);
|
||||
|
||||
my $Label = $DynamicFieldConfig->{Label};
|
||||
|
||||
$Result{ $DynamicFieldConfig->{Name} } = {
|
||||
Label => $Label,
|
||||
Value => $ValueStrg->{Value},
|
||||
Title => $ValueStrg->{Title},
|
||||
};
|
||||
|
||||
if ( $ValueStrg->{Link} ) {
|
||||
$Result{ $DynamicFieldConfig->{Name} }->{Link} = $ValueStrg->{Link};
|
||||
}
|
||||
}
|
||||
|
||||
return %Result;
|
||||
}
|
||||
|
||||
=head1 PRIVATE FUNCTIONS
|
||||
|
||||
=head2 _ArticleSenderImage()
|
||||
|
||||
Get URL used for article sender image.
|
||||
|
||||
my $SenderImage = $ArticleBaseObject->_ArticleSenderImage(
|
||||
Sender => 'John Doe <jdoe@example.com>',
|
||||
);
|
||||
|
||||
Returns:
|
||||
|
||||
$SenderImage = '//gravatar.com/avatar/28a58af1db24962e81212115e7cac685?s=80';
|
||||
|
||||
=cut
|
||||
|
||||
sub _ArticleSenderImage {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $Result = '';
|
||||
|
||||
return $Result if !$Param{Sender};
|
||||
|
||||
my $Size = 80;
|
||||
|
||||
# Get email address from sender field.
|
||||
my $EmailParser = Kernel::System::EmailParser->new(
|
||||
%{$Self},
|
||||
Mode => 'Standalone',
|
||||
);
|
||||
my @Addresses = $EmailParser->SplitAddressLine( Line => $Param{Sender} );
|
||||
if (@Addresses) {
|
||||
my $Email = $EmailParser->GetEmailAddress( Email => $Addresses[0] );
|
||||
if ($Email) {
|
||||
my $DefaultIcon
|
||||
= $Kernel::OM->Get('Kernel::Config')->Get('Frontend::Gravatar::ArticleDefaultImage') || 'mm';
|
||||
|
||||
# Get current user's email and compare it to the sender's email.
|
||||
if ( $Param{UserID} ) {
|
||||
my %CurrentUserData = $Kernel::OM->Get('Kernel::System::User')->GetUserData( UserID => $Param{UserID} );
|
||||
if ( $Email eq $CurrentUserData{UserEmail} ) {
|
||||
$DefaultIcon = $Kernel::OM->Get('Kernel::Config')->Get('Frontend::Gravatar::DefaultImage') | 'mm';
|
||||
}
|
||||
}
|
||||
|
||||
$Result = '//www.gravatar.com/avatar/' . md5_hex( lc $Email ) . '?s=' . $Size . '&d=' . $DefaultIcon;
|
||||
}
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
sub _ArticleModuleMeta {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID UserID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# get config object
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
# check whether auto article links should be used
|
||||
return if !$ConfigObject->Get('Ticket::Frontend::ZoomCollectMeta');
|
||||
return if !$ConfigObject->Get('Ticket::Frontend::ZoomCollectMetaFilters');
|
||||
|
||||
my $ArticlePlain = $LayoutObject->ArticlePreview(
|
||||
%Param,
|
||||
ResultType => 'plain',
|
||||
);
|
||||
|
||||
my @Data;
|
||||
|
||||
# find words to replace
|
||||
my %Config = %{ $ConfigObject->Get('Ticket::Frontend::ZoomCollectMetaFilters') };
|
||||
|
||||
FILTER:
|
||||
for my $Filter ( values %Config ) {
|
||||
|
||||
my %FilterData;
|
||||
|
||||
# check for needed data
|
||||
next FILTER if !$Filter->{RegExp};
|
||||
next FILTER if !$Filter->{Meta};
|
||||
next FILTER if !$Filter->{Meta}->{Name};
|
||||
next FILTER if !$Filter->{Meta}->{URL};
|
||||
|
||||
# iterage through regular expressions and create a hash with found matches
|
||||
my @Matches;
|
||||
for my $RegExp ( @{ $Filter->{RegExp} } ) {
|
||||
|
||||
my @Count = $RegExp =~ m{\(}gx;
|
||||
my $Elements = scalar @Count;
|
||||
|
||||
if ( my @MatchData = $ArticlePlain =~ m{([\s:]$RegExp)}gxi ) {
|
||||
my $Counter = 0;
|
||||
|
||||
MATCH:
|
||||
while ( $MatchData[$Counter] ) {
|
||||
|
||||
my $WholeMatchString = $MatchData[$Counter];
|
||||
$WholeMatchString =~ s/^\s+|\s+$//g;
|
||||
if ( grep { $_->{Name} eq $WholeMatchString } @Matches ) {
|
||||
$Counter += $Elements + 1;
|
||||
next MATCH;
|
||||
}
|
||||
|
||||
my %Parts;
|
||||
for ( 1 .. $Elements ) {
|
||||
$Parts{$_} = $MatchData[ $Counter + $_ ];
|
||||
}
|
||||
$Counter += $Elements + 1;
|
||||
|
||||
push @Matches, {
|
||||
Name => $WholeMatchString,
|
||||
Parts => \%Parts,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( scalar @Matches ) {
|
||||
|
||||
$FilterData{Name} = $Filter->{Meta}->{Name};
|
||||
|
||||
# iterate trough matches and build URLs from configuration
|
||||
for my $Match (@Matches) {
|
||||
|
||||
my $MatchQuote = $LayoutObject->Ascii2Html( Text => $Match->{Name} );
|
||||
my $URL = $Filter->{Meta}->{URL};
|
||||
my $URLPreview = $Filter->{Meta}->{URLPreview};
|
||||
|
||||
# replace the whole keyword
|
||||
my $MatchLinkEncode = $LayoutObject->LinkEncode( $Match->{Name} );
|
||||
$URL =~ s/<MATCH>/$MatchLinkEncode/g;
|
||||
$URLPreview =~ s/<MATCH>/$MatchLinkEncode/g;
|
||||
|
||||
# replace the keyword components
|
||||
for my $Part ( sort keys %{ $Match->{Parts} || {} } ) {
|
||||
$MatchLinkEncode = $LayoutObject->LinkEncode( $Match->{Parts}->{$Part} );
|
||||
$URL =~ s/<MATCH$Part>/$MatchLinkEncode/g;
|
||||
$URLPreview =~ s/<MATCH$Part>/$MatchLinkEncode/g;
|
||||
}
|
||||
|
||||
push @{ $FilterData{Matches} }, {
|
||||
Text => $Match->{Name},
|
||||
URL => $URL,
|
||||
URLPreview => $URLPreview,
|
||||
Target => $Filter->{Meta}->{Target} || '_blank',
|
||||
};
|
||||
}
|
||||
push @Data, \%FilterData;
|
||||
}
|
||||
}
|
||||
|
||||
return @Data;
|
||||
}
|
||||
|
||||
1;
|
||||
136
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Chat.pm
Normal file
136
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Chat.pm
Normal file
@@ -0,0 +1,136 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::Chat;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Agent::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsPositiveInteger);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::CommunicationChannel',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::System::User',
|
||||
);
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article html.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
ArticleActions => [], # (optional)
|
||||
UserID => 123, # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(%Param);
|
||||
|
||||
my %Article = $ArticleBackendObject->ArticleGet(%Param);
|
||||
if ( !%Article ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Article not found (ArticleID=$Param{ArticleID})!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if HTML should be displayed.
|
||||
my $ShowHTML = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
# Get channel specific fields
|
||||
my %ArticleFields = $LayoutObject->ArticleFields(%Param);
|
||||
|
||||
# Get dynamic fields and accounted time
|
||||
my %ArticleMetaFields = $Self->ArticleMetaFields(%Param);
|
||||
|
||||
# Get data from modules like Google CVE search
|
||||
my @ArticleModuleMeta = $Self->_ArticleModuleMeta(%Param);
|
||||
|
||||
# Show created by string, if creator is different from admin user.
|
||||
if ( $Article{CreateBy} > 1 ) {
|
||||
$Article{CreateByUser} = $Kernel::OM->Get('Kernel::System::User')->UserName( UserID => $Article{CreateBy} );
|
||||
}
|
||||
|
||||
my $ArticleContent = $LayoutObject->ArticlePreview(
|
||||
TicketID => $Param{TicketID},
|
||||
ArticleID => $Param{ArticleID},
|
||||
ResultType => $ShowHTML ? 'HTML' : 'plain',
|
||||
);
|
||||
|
||||
if ( !$ShowHTML ) {
|
||||
|
||||
# html quoting
|
||||
$ArticleContent = $LayoutObject->Ascii2Html(
|
||||
NewLine => $ConfigObject->Get('DefaultViewNewLine'),
|
||||
Text => $ArticleContent,
|
||||
VMax => $ConfigObject->Get('DefaultViewLines') || 5000,
|
||||
HTMLResultMode => 1,
|
||||
LinkFeature => 1,
|
||||
);
|
||||
}
|
||||
|
||||
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
|
||||
ChannelID => $Article{CommunicationChannelID},
|
||||
);
|
||||
|
||||
my $Content = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketZoom/ArticleRender/Chat',
|
||||
Data => {
|
||||
%Article,
|
||||
ArticleFields => \%ArticleFields,
|
||||
ArticleMetaFields => \%ArticleMetaFields,
|
||||
ArticleModuleMeta => \@ArticleModuleMeta,
|
||||
MenuItems => $Param{ArticleActions},
|
||||
Body => $ArticleContent,
|
||||
HTML => $ShowHTML,
|
||||
CommunicationChannel => $CommunicationChannel{DisplayName},
|
||||
ChannelIcon => $CommunicationChannel{DisplayIcon},
|
||||
SenderImage => $Self->_ArticleSenderImage(
|
||||
Sender => $ArticleFields{Sender}->{Value},
|
||||
UserID => $Param{UserID},
|
||||
),
|
||||
SenderInitials => $LayoutObject->UserInitialsGet(
|
||||
Fullname => $ArticleFields{Sender}->{Realname},
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
return $Content;
|
||||
}
|
||||
|
||||
1;
|
||||
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Email.pm
Normal file
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Email.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::Email;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Agent::MIMEBase';
|
||||
|
||||
our @ObjectDependencies = (
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Internal.pm
Normal file
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Internal.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::Internal;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Agent::MIMEBase';
|
||||
|
||||
our @ObjectDependencies = (
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
122
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Invalid.pm
Normal file
122
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Invalid.pm
Normal file
@@ -0,0 +1,122 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::Invalid;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Agent::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsPositiveInteger);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::CommunicationChannel',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::System::User',
|
||||
);
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns invalid article HTML.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
ArticleActions => [], # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(%Param);
|
||||
|
||||
my %Article = $ArticleBackendObject->ArticleGet(%Param);
|
||||
if ( !%Article ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Article not found (ArticleID=$Param{ArticleID})!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if HTML should be displayed.
|
||||
my $ShowHTML = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
# Get channel specific fields
|
||||
my %ArticleFields = $LayoutObject->ArticleFields(%Param);
|
||||
|
||||
# Show created by string, if creator is different from admin user.
|
||||
if ( $Article{CreateBy} > 1 ) {
|
||||
$Article{CreateByUser} = $Kernel::OM->Get('Kernel::System::User')->UserName( UserID => $Article{CreateBy} );
|
||||
}
|
||||
|
||||
my $ArticleContent = $LayoutObject->ArticlePreview(
|
||||
TicketID => $Param{TicketID},
|
||||
ArticleID => $Param{ArticleID},
|
||||
ResultType => $ShowHTML ? 'HTML' : 'plain',
|
||||
);
|
||||
|
||||
if ( !$ShowHTML ) {
|
||||
|
||||
# HTML quoting.
|
||||
$ArticleContent = $LayoutObject->Ascii2Html(
|
||||
NewLine => $ConfigObject->Get('DefaultViewNewLine'),
|
||||
Text => $ArticleContent,
|
||||
VMax => $ConfigObject->Get('DefaultViewLines') || 5000,
|
||||
HTMLResultMode => 1,
|
||||
LinkFeature => 1,
|
||||
);
|
||||
}
|
||||
|
||||
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
|
||||
ChannelID => $Article{CommunicationChannelID},
|
||||
);
|
||||
|
||||
my $Content = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketZoom/ArticleRender/Invalid',
|
||||
Data => {
|
||||
%Article,
|
||||
ArticleFields => \%ArticleFields,
|
||||
MenuItems => $Param{ArticleActions},
|
||||
Body => $ArticleContent,
|
||||
HTML => $ShowHTML,
|
||||
CommunicationChannel => $CommunicationChannel{DisplayName},
|
||||
ChannelIcon => $CommunicationChannel{DisplayIcon},
|
||||
SenderInitials => $LayoutObject->UserInitialsGet(
|
||||
Fullname => $ArticleFields{Sender}->{Realname},
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
return $Content;
|
||||
}
|
||||
|
||||
1;
|
||||
256
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/MIMEBase.pm
Normal file
256
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/MIMEBase.pm
Normal file
@@ -0,0 +1,256 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::MIMEBase;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Agent::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsPositiveInteger);
|
||||
use Kernel::Language qw(Translatable);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Article::MIMEBase',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::CommunicationChannel',
|
||||
'Kernel::System::Main',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::System::User',
|
||||
);
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article html.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
ShowBrowserLinkMessage => 1, # (optional) Default: 0.
|
||||
ArticleActions => [], # (optional)
|
||||
UserID => 123, # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
|
||||
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(%Param);
|
||||
|
||||
my %Article = $ArticleBackendObject->ArticleGet(
|
||||
%Param,
|
||||
RealNames => 1,
|
||||
);
|
||||
if ( !%Article ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Article not found (ArticleID=$Param{ArticleID})!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get channel specific fields
|
||||
my %ArticleFields = $LayoutObject->ArticleFields(%Param);
|
||||
|
||||
# Get dynamic fields and accounted time
|
||||
my %ArticleMetaFields = $Self->ArticleMetaFields(%Param);
|
||||
|
||||
# Get data from modules like Google CVE search
|
||||
my @ArticleModuleMeta = $Self->_ArticleModuleMeta(%Param);
|
||||
|
||||
# Show created by string, if creator is different from admin user.
|
||||
if ( $Article{CreateBy} > 1 ) {
|
||||
$Article{CreateByUser} = $Kernel::OM->Get('Kernel::System::User')->UserName( UserID => $Article{CreateBy} );
|
||||
}
|
||||
|
||||
my $RichTextEnabled = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
# Show HTML if RichText is enabled and HTML attachment isn't missing.
|
||||
my $ShowHTML = $RichTextEnabled;
|
||||
my $HTMLBodyAttachID = $Kernel::OM->Get('Kernel::Output::HTML::Article::MIMEBase')->HTMLBodyAttachmentIDGet(
|
||||
%Param,
|
||||
);
|
||||
if ( $ShowHTML && !$HTMLBodyAttachID ) {
|
||||
$ShowHTML = 0;
|
||||
}
|
||||
|
||||
# Strip plain text attachments by default.
|
||||
my $ExcludePlainText = 1;
|
||||
|
||||
# Do not strip plain text attachments if no plain text article body was found.
|
||||
if ( $Article{Body} && $Article{Body} eq '- no text message => see attachment -' ) {
|
||||
$ExcludePlainText = 0;
|
||||
}
|
||||
|
||||
# Get attachment index (excluding body attachments).
|
||||
my %AtmIndex = $ArticleBackendObject->ArticleAttachmentIndex(
|
||||
ArticleID => $Param{ArticleID},
|
||||
ExcludePlainText => $ExcludePlainText,
|
||||
ExcludeHTMLBody => $RichTextEnabled,
|
||||
ExcludeInline => $RichTextEnabled,
|
||||
);
|
||||
|
||||
my @ArticleAttachments;
|
||||
|
||||
# Add block for attachments.
|
||||
if (%AtmIndex) {
|
||||
my $Config = $ConfigObject->Get('Ticket::Frontend::ArticleAttachmentModule');
|
||||
|
||||
ATTACHMENT:
|
||||
for my $FileID ( sort keys %AtmIndex ) {
|
||||
|
||||
my $Attachment;
|
||||
|
||||
# Run article attachment modules.
|
||||
next ATTACHMENT if ref $Config ne 'HASH';
|
||||
my %Jobs = %{$Config};
|
||||
|
||||
JOB:
|
||||
for my $Job ( sort keys %Jobs ) {
|
||||
my %File = %{ $AtmIndex{$FileID} };
|
||||
|
||||
# load module
|
||||
next JOB if !$MainObject->Require( $Jobs{$Job}->{Module} );
|
||||
my $Object = $Jobs{$Job}->{Module}->new(
|
||||
%{$Self},
|
||||
TicketID => $Param{TicketID},
|
||||
ArticleID => $Param{ArticleID},
|
||||
UserID => $Param{UserID} || 1,
|
||||
);
|
||||
|
||||
# run module
|
||||
my %Data = $Object->Run(
|
||||
File => {
|
||||
%File,
|
||||
FileID => $FileID,
|
||||
},
|
||||
TicketID => $Param{TicketID},
|
||||
Article => \%Article,
|
||||
);
|
||||
|
||||
if (%Data) {
|
||||
%File = %Data;
|
||||
}
|
||||
|
||||
$File{Links} = [
|
||||
{
|
||||
Action => $File{Action},
|
||||
Class => $File{Class},
|
||||
Link => $File{Link},
|
||||
Target => $File{Target},
|
||||
},
|
||||
];
|
||||
if ( $File{Action} && $File{Action} ne 'Download' ) {
|
||||
delete $File{Action};
|
||||
delete $File{Class};
|
||||
delete $File{Link};
|
||||
delete $File{Target};
|
||||
}
|
||||
|
||||
if ($Attachment) {
|
||||
push @{ $Attachment->{Links} }, $File{Links}->[0];
|
||||
}
|
||||
else {
|
||||
$Attachment = \%File;
|
||||
}
|
||||
}
|
||||
push @ArticleAttachments, $Attachment;
|
||||
}
|
||||
}
|
||||
|
||||
my $ArticleContent;
|
||||
|
||||
if ($ShowHTML) {
|
||||
if ( $Param{ShowBrowserLinkMessage} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'BrowserLinkMessage',
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$ArticleContent = $LayoutObject->ArticlePreview(
|
||||
%Param,
|
||||
ResultType => 'plain',
|
||||
);
|
||||
|
||||
# html quoting
|
||||
$ArticleContent = $LayoutObject->Ascii2Html(
|
||||
NewLine => $ConfigObject->Get('DefaultViewNewLine'),
|
||||
Text => $ArticleContent,
|
||||
VMax => $ConfigObject->Get('DefaultViewLines') || 5000,
|
||||
HTMLResultMode => 1,
|
||||
LinkFeature => 1,
|
||||
);
|
||||
}
|
||||
|
||||
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
|
||||
ChannelID => $Article{CommunicationChannelID},
|
||||
);
|
||||
|
||||
if ( $CommunicationChannel{ChannelName} eq 'Email' ) {
|
||||
my $TransmissionStatus = $ArticleBackendObject->ArticleTransmissionStatus(
|
||||
ArticleID => $Article{ArticleID},
|
||||
);
|
||||
if ($TransmissionStatus) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TransmissionStatusMessage',
|
||||
Data => $TransmissionStatus,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
my $Content = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketZoom/ArticleRender/MIMEBase',
|
||||
Data => {
|
||||
%Article,
|
||||
ArticleFields => \%ArticleFields,
|
||||
ArticleMetaFields => \%ArticleMetaFields,
|
||||
ArticleModuleMeta => \@ArticleModuleMeta,
|
||||
Attachments => \@ArticleAttachments,
|
||||
MenuItems => $Param{ArticleActions},
|
||||
Body => $ArticleContent,
|
||||
HTML => $ShowHTML,
|
||||
CommunicationChannel => $CommunicationChannel{DisplayName},
|
||||
ChannelIcon => $CommunicationChannel{DisplayIcon},
|
||||
SenderImage => $Self->_ArticleSenderImage(
|
||||
Sender => $Article{From},
|
||||
UserID => $Param{UserID},
|
||||
),
|
||||
SenderInitials => $LayoutObject->UserInitialsGet(
|
||||
Fullname => $Article{FromRealname},
|
||||
),
|
||||
},
|
||||
);
|
||||
|
||||
return $Content;
|
||||
}
|
||||
|
||||
1;
|
||||
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Phone.pm
Normal file
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Agent/Phone.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Agent::Phone;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Agent::MIMEBase';
|
||||
|
||||
our @ObjectDependencies = (
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
182
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Base.pm
Normal file
182
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Base.pm
Normal file
@@ -0,0 +1,182 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::Base;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Digest::MD5 qw(md5_hex);
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsHashRefWithData);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::DynamicField',
|
||||
'Kernel::System::DynamicField::Backend',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
);
|
||||
|
||||
sub new {
|
||||
my ( $Type, %Param ) = @_;
|
||||
|
||||
# allocate new hash for object
|
||||
my $Self = {};
|
||||
bless( $Self, $Type );
|
||||
|
||||
return $Self;
|
||||
}
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article html.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
ShowBrowserLinkMessage => 1, # (optional) Default: 0.
|
||||
ArticleActions => [], # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
die 'Virtual method in base class must not be called.';
|
||||
}
|
||||
|
||||
=head2 ArticleMetaFields()
|
||||
|
||||
Returns common fields for any article.
|
||||
|
||||
my %ArticleMetaFields = $ArticleBaseObject->ArticleMetaFields(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
);
|
||||
|
||||
Returns:
|
||||
|
||||
%ArticleMetaFields = (
|
||||
DynamicField_Item => {
|
||||
Label => 'Item', # mandatory
|
||||
Value => 'Value', # mandatory
|
||||
Link => 'http://...', # optional
|
||||
},
|
||||
AccountedTime => {
|
||||
...
|
||||
},
|
||||
);
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleMetaFields {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $ArticleObject = $Kernel::OM->Get('Kernel::System::Ticket::Article');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $BackendObject = $Kernel::OM->Get('Kernel::System::DynamicField::Backend');
|
||||
|
||||
my %Result;
|
||||
|
||||
# show accounted article time
|
||||
if ( $ConfigObject->Get('Ticket::Frontend::CustomerTicketZoom')->{ZoomTimeDisplay} ) {
|
||||
my $ArticleTime = $ArticleObject->ArticleAccountedTimeGet(
|
||||
ArticleID => $Param{ArticleID},
|
||||
);
|
||||
if ($ArticleTime) {
|
||||
$Result{Time} = {
|
||||
Label => "Time",
|
||||
Value => $ArticleTime,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# get dynamic field config for frontend module
|
||||
my $DynamicFieldFilter = {
|
||||
%{ $ConfigObject->Get("Ticket::Frontend::CustomerTicketZoom")->{DynamicField} || {} },
|
||||
|
||||
# TODO: Check if there are process dynamic fields for customer interface
|
||||
# %{
|
||||
# $ConfigObject->Get("Ticket::Frontend::CustomerTicketZoom")->{ProcessWidgetDynamicField}
|
||||
# || {}
|
||||
# },
|
||||
};
|
||||
|
||||
# get the dynamic fields for article object
|
||||
my $DynamicField = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldListGet(
|
||||
Valid => 1,
|
||||
ObjectType => ['Article'],
|
||||
FieldFilter => $DynamicFieldFilter || {},
|
||||
);
|
||||
my $DynamicFieldBackendObject = $Kernel::OM->Get('Kernel::System::DynamicField::Backend');
|
||||
|
||||
# cycle trough the activated Dynamic Fields
|
||||
DYNAMICFIELD:
|
||||
for my $DynamicFieldConfig ( @{$DynamicField} ) {
|
||||
next DYNAMICFIELD if !IsHashRefWithData($DynamicFieldConfig);
|
||||
|
||||
# skip the dynamic field if is not desinged for customer interface
|
||||
my $IsCustomerInterfaceCapable = $BackendObject->HasBehavior(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
Behavior => 'IsCustomerInterfaceCapable',
|
||||
);
|
||||
next DYNAMICFIELD if !$IsCustomerInterfaceCapable;
|
||||
|
||||
my $Value = $DynamicFieldBackendObject->ValueGet(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
ObjectID => $Param{ArticleID},
|
||||
);
|
||||
|
||||
next DYNAMICFIELD if !$Value;
|
||||
next DYNAMICFIELD if $Value eq '';
|
||||
|
||||
# get print string for this dynamic field
|
||||
my $ValueStrg = $DynamicFieldBackendObject->DisplayValueRender(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
Value => $Value,
|
||||
ValueMaxChars => 160,
|
||||
LayoutObject => $LayoutObject,
|
||||
);
|
||||
|
||||
my $Label = $DynamicFieldConfig->{Label};
|
||||
|
||||
$Result{ $DynamicFieldConfig->{Name} } = {
|
||||
Label => $Label,
|
||||
Value => $ValueStrg->{Value},
|
||||
Title => $ValueStrg->{Title},
|
||||
};
|
||||
|
||||
if ( $ValueStrg->{Link} ) {
|
||||
$Result{ $DynamicFieldConfig->{Name} }->{Link} = $ValueStrg->{Link};
|
||||
}
|
||||
|
||||
if ( $ValueStrg->{LinkPreview} ) {
|
||||
$Result{ $DynamicFieldConfig->{Name} }->{LinkPreview} = $ValueStrg->{LinkPreview};
|
||||
}
|
||||
}
|
||||
|
||||
return %Result;
|
||||
}
|
||||
|
||||
1;
|
||||
130
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Chat.pm
Normal file
130
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Chat.pm
Normal file
@@ -0,0 +1,130 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::Chat;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Customer::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsPositiveInteger);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::CommunicationChannel',
|
||||
'Kernel::System::Main',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::Output::HTML::Article::MIMEBase',
|
||||
);
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article html.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
Class => 'Visible', # (optional)
|
||||
ShowBrowserLinkMessage => 1, # (optional) Default: 0.
|
||||
ArticleActions => [], # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
|
||||
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(%Param);
|
||||
|
||||
my %Article = $ArticleBackendObject->ArticleGet(
|
||||
%Param,
|
||||
RealNames => 1,
|
||||
);
|
||||
if ( !%Article ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Article not found (ArticleID=$Param{ArticleID})!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get channel specific fields
|
||||
my %ArticleFields = $LayoutObject->ArticleFields(%Param);
|
||||
|
||||
# Get dynamic fields and accounted time
|
||||
my %ArticleMetaFields = $Self->ArticleMetaFields(%Param);
|
||||
|
||||
my $RichTextEnabled = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
# Check if HTML should be displayed.
|
||||
my $ShowHTML = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
my $ArticleContent = $LayoutObject->ArticlePreview(
|
||||
%Param,
|
||||
ResultType => $ShowHTML ? 'HTML' : 'plain',
|
||||
);
|
||||
|
||||
if ( !$ShowHTML ) {
|
||||
|
||||
# html quoting
|
||||
$ArticleContent = $LayoutObject->Ascii2Html(
|
||||
NewLine => $ConfigObject->Get('DefaultViewNewLine'),
|
||||
Text => $ArticleContent,
|
||||
VMax => $ConfigObject->Get('DefaultViewLines') || 5000,
|
||||
HTMLResultMode => 1,
|
||||
LinkFeature => 1,
|
||||
);
|
||||
}
|
||||
|
||||
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
|
||||
ChannelID => $Article{CommunicationChannelID},
|
||||
);
|
||||
|
||||
my $Content = $LayoutObject->Output(
|
||||
TemplateFile => 'CustomerTicketZoom/ArticleRender/Chat',
|
||||
Data => {
|
||||
%Article,
|
||||
ArticleFields => \%ArticleFields,
|
||||
ArticleMetaFields => \%ArticleMetaFields,
|
||||
Body => $ArticleContent,
|
||||
HTML => $ShowHTML,
|
||||
CommunicationChannel => $CommunicationChannel{DisplayName},
|
||||
ChannelIcon => $CommunicationChannel{DisplayIcon},
|
||||
Class => $Param{Class},
|
||||
Age => $Param{ArticleAge},
|
||||
},
|
||||
);
|
||||
|
||||
return $Content;
|
||||
}
|
||||
|
||||
1;
|
||||
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Email.pm
Normal file
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Email.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::Email;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Customer::MIMEBase';
|
||||
|
||||
our @ObjectDependencies = (
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Internal.pm
Normal file
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Internal.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::Internal;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Customer::MIMEBase';
|
||||
|
||||
our @ObjectDependencies = (
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
121
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Invalid.pm
Normal file
121
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Invalid.pm
Normal file
@@ -0,0 +1,121 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::Invalid;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Customer::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsPositiveInteger);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::CommunicationChannel',
|
||||
'Kernel::System::Main',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::Output::HTML::Article::MIMEBase',
|
||||
);
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article HTML.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
Class => 'Visible', # (optional)
|
||||
ShowBrowserLinkMessage => 1, # (optional) Default: 0.
|
||||
ArticleActions => [], # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
|
||||
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(%Param);
|
||||
|
||||
my %Article = $ArticleBackendObject->ArticleGet(
|
||||
%Param,
|
||||
RealNames => 1,
|
||||
);
|
||||
if ( !%Article ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Article not found (ArticleID=$Param{ArticleID})!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get channel specific fields
|
||||
my %ArticleFields = $LayoutObject->ArticleFields(%Param);
|
||||
|
||||
# Check if HTML should be displayed.
|
||||
my $ShowHTML = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
my $ArticleContent = $LayoutObject->ArticlePreview(
|
||||
%Param,
|
||||
ResultType => $ShowHTML ? 'HTML' : 'plain',
|
||||
);
|
||||
|
||||
if ( !$ShowHTML ) {
|
||||
|
||||
# html quoting
|
||||
$ArticleContent = $LayoutObject->Ascii2Html(
|
||||
NewLine => $ConfigObject->Get('DefaultViewNewLine'),
|
||||
Text => $ArticleContent,
|
||||
VMax => $ConfigObject->Get('DefaultViewLines') || 5000,
|
||||
HTMLResultMode => 1,
|
||||
LinkFeature => 1,
|
||||
);
|
||||
}
|
||||
|
||||
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
|
||||
ChannelID => $Article{CommunicationChannelID},
|
||||
);
|
||||
|
||||
my $Content = $LayoutObject->Output(
|
||||
TemplateFile => 'CustomerTicketZoom/ArticleRender/Invalid',
|
||||
Data => {
|
||||
%Article,
|
||||
ArticleFields => \%ArticleFields,
|
||||
Body => $ArticleContent,
|
||||
HTML => $ShowHTML,
|
||||
CommunicationChannel => $CommunicationChannel{DisplayName},
|
||||
ChannelIcon => $CommunicationChannel{DisplayIcon},
|
||||
Class => $Param{Class},
|
||||
Age => $Param{ArticleAge},
|
||||
},
|
||||
);
|
||||
|
||||
return $Content;
|
||||
}
|
||||
|
||||
1;
|
||||
205
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/MIMEBase.pm
Normal file
205
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/MIMEBase.pm
Normal file
@@ -0,0 +1,205 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::MIMEBase;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Customer::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::System::VariableCheck qw(IsPositiveInteger);
|
||||
|
||||
our @ObjectDependencies = (
|
||||
'Kernel::Config',
|
||||
'Kernel::Output::HTML::Layout',
|
||||
'Kernel::System::CommunicationChannel',
|
||||
'Kernel::System::Main',
|
||||
'Kernel::System::Log',
|
||||
'Kernel::System::Ticket::Article',
|
||||
'Kernel::Output::HTML::Article::MIMEBase',
|
||||
);
|
||||
|
||||
=head2 ArticleRender()
|
||||
|
||||
Returns article html.
|
||||
|
||||
my $HTML = $ArticleBaseObject->ArticleRender(
|
||||
TicketID => 123, # (required)
|
||||
ArticleID => 123, # (required)
|
||||
ShowBrowserLinkMessage => 1, # (optional) Default: 0.
|
||||
ArticleActions => [], # (optional)
|
||||
Class => 'Visible', # (optional)
|
||||
);
|
||||
|
||||
Result:
|
||||
$HTML = "<div>...</div>";
|
||||
|
||||
=cut
|
||||
|
||||
sub ArticleRender {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# Check needed stuff.
|
||||
for my $Needed (qw(TicketID ArticleID)) {
|
||||
if ( !$Param{$Needed} ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Need $Needed!",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');
|
||||
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(%Param);
|
||||
|
||||
my %Article = $ArticleBackendObject->ArticleGet(
|
||||
%Param,
|
||||
RealNames => 1,
|
||||
);
|
||||
if ( !%Article ) {
|
||||
$Kernel::OM->Get('Kernel::System::Log')->Log(
|
||||
Priority => 'error',
|
||||
Message => "Article not found (ArticleID=$Param{ArticleID})!"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
# Get channel specific fields
|
||||
my %ArticleFields = $LayoutObject->ArticleFields(%Param);
|
||||
|
||||
# Get dynamic fields and accounted time
|
||||
my %ArticleMetaFields = $Self->ArticleMetaFields(%Param);
|
||||
|
||||
my $RichTextEnabled = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
# Strip plain text attachments by default.
|
||||
my $ExcludePlainText = 1;
|
||||
|
||||
# Do not strip plain text attachments if no plain text article body was found.
|
||||
if ( $Article{Body} && $Article{Body} eq '- no text message => see attachment -' ) {
|
||||
$ExcludePlainText = 0;
|
||||
}
|
||||
|
||||
# Get attachment index (excluding body attachments).
|
||||
my %AtmIndex = $ArticleBackendObject->ArticleAttachmentIndex(
|
||||
ArticleID => $Param{ArticleID},
|
||||
ExcludePlainText => $ExcludePlainText,
|
||||
ExcludeHTMLBody => $RichTextEnabled,
|
||||
ExcludeInline => $RichTextEnabled,
|
||||
);
|
||||
|
||||
my @ArticleAttachments;
|
||||
|
||||
# Include attachments.
|
||||
if (%AtmIndex) {
|
||||
|
||||
my $Type = $ConfigObject->Get('AttachmentDownloadType') || 'attachment';
|
||||
|
||||
# If attachment will be downloaded, don't open the link in new window!
|
||||
my $Target = '';
|
||||
if ( $Type =~ /inline/i ) {
|
||||
$Target = 'target="attachment" ';
|
||||
}
|
||||
|
||||
ATTACHMENT:
|
||||
for my $FileID ( sort keys %AtmIndex ) {
|
||||
push @ArticleAttachments, {
|
||||
%{ $AtmIndex{$FileID} },
|
||||
Action => 'Download',
|
||||
Link => $LayoutObject->{Baselink} .
|
||||
"Action=CustomerTicketAttachment;TicketID=$Param{TicketID};ArticleID=$Param{ArticleID};FileID=$FileID",
|
||||
Target => $Target,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# Check if HTML should be displayed.
|
||||
my $ShowHTML = $ConfigObject->Get('Ticket::Frontend::ZoomRichTextForce')
|
||||
|| $LayoutObject->{BrowserRichText}
|
||||
|| 0;
|
||||
|
||||
# Check if HTML attachment is missing.
|
||||
if ( $ShowHTML && !$Kernel::OM->Get('Kernel::Output::HTML::Article::MIMEBase')->HTMLBodyAttachmentIDGet(%Param) ) {
|
||||
$ShowHTML = 0;
|
||||
}
|
||||
|
||||
my $ArticleContent;
|
||||
|
||||
if ( !$ShowHTML ) {
|
||||
|
||||
$ArticleContent = $LayoutObject->ArticlePreview(
|
||||
%Param,
|
||||
ResultType => 'plain',
|
||||
);
|
||||
|
||||
# html quoting
|
||||
$ArticleContent = $LayoutObject->Ascii2Html(
|
||||
NewLine => $ConfigObject->Get('DefaultViewNewLine'),
|
||||
Text => $ArticleContent,
|
||||
VMax => $ConfigObject->Get('DefaultViewLines') || 5000,
|
||||
HTMLResultMode => 1,
|
||||
LinkFeature => 1,
|
||||
);
|
||||
}
|
||||
|
||||
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
|
||||
ChannelID => $Article{CommunicationChannelID},
|
||||
);
|
||||
|
||||
# Get screen config for CustomerTicketZoom
|
||||
my $ScreenConfig = $ConfigObject->Get('Ticket::Frontend::CustomerTicketZoom');
|
||||
|
||||
# Define if internal notes that are marked as "visible for customer" should show the real name of the agent
|
||||
# or just a default agent name.
|
||||
if (
|
||||
$ScreenConfig->{DisplayNoteFrom}
|
||||
&& $ScreenConfig->{DisplayNoteFrom} eq 'DefaultAgentName'
|
||||
&& $CommunicationChannel{ChannelName} eq 'Internal'
|
||||
&& $Article{SenderType} eq 'agent'
|
||||
&& $Article{IsVisibleForCustomer}
|
||||
)
|
||||
{
|
||||
|
||||
my $DefaultAgentName
|
||||
= $LayoutObject->{LanguageObject}->Translate( $ScreenConfig->{DefaultAgentName} || 'Support Agent' );
|
||||
$ArticleFields{From}->{Realname} = $DefaultAgentName;
|
||||
$ArticleFields{From}->{Value} = $DefaultAgentName;
|
||||
$ArticleFields{Sender}->{Realname} = $DefaultAgentName;
|
||||
$ArticleFields{Sender}->{Value} = $DefaultAgentName;
|
||||
$Article{FromRealname} = $DefaultAgentName;
|
||||
}
|
||||
|
||||
my $Content = $LayoutObject->Output(
|
||||
TemplateFile => 'CustomerTicketZoom/ArticleRender/MIMEBase',
|
||||
Data => {
|
||||
%Article,
|
||||
ArticleFields => \%ArticleFields,
|
||||
ArticleMetaFields => \%ArticleMetaFields,
|
||||
Class => $Param{Class},
|
||||
Attachments => \@ArticleAttachments,
|
||||
MenuItems => $Param{ArticleActions},
|
||||
Body => $ArticleContent,
|
||||
HTML => $ShowHTML,
|
||||
CommunicationChannel => $CommunicationChannel{DisplayName},
|
||||
ChannelIcon => $CommunicationChannel{DisplayIcon},
|
||||
BrowserLinkMessage => $Param{ShowBrowserLinkMessage} && $ShowHTML,
|
||||
BodyHTMLLoad => $Param{ArticleExpanded},
|
||||
Age => $Param{ArticleAge},
|
||||
},
|
||||
);
|
||||
|
||||
return $Content;
|
||||
}
|
||||
|
||||
1;
|
||||
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Phone.pm
Normal file
20
Perl OTRS/Kernel/Output/HTML/TicketZoom/Customer/Phone.pm
Normal file
@@ -0,0 +1,20 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::Customer::Phone;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use parent 'Kernel::Output::HTML::TicketZoom::Customer::MIMEBase';
|
||||
|
||||
our @ObjectDependencies = (
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
@@ -0,0 +1,51 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::CustomerInformation;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $ObjectManagerDisabled = 1;
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my %CustomerData;
|
||||
if ( $Param{Ticket}->{CustomerUserID} ) {
|
||||
%CustomerData = $Kernel::OM->Get('Kernel::System::CustomerUser')->CustomerUserDataGet(
|
||||
User => $Param{Ticket}->{CustomerUserID},
|
||||
);
|
||||
}
|
||||
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
if ( $CustomerData{UserTitle} ) {
|
||||
$CustomerData{UserTitle} = $LayoutObject->{LanguageObject}->Translate( $CustomerData{UserTitle} );
|
||||
}
|
||||
|
||||
my $CustomerTable = $LayoutObject->AgentCustomerViewTable(
|
||||
Data => \%CustomerData,
|
||||
Ticket => $Param{Ticket},
|
||||
Max => $Kernel::OM->Get('Kernel::Config')->Get('Ticket::Frontend::CustomerInfoZoomMaxSize'),
|
||||
);
|
||||
my $Output = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketZoom/CustomerInformation',
|
||||
Data => {
|
||||
CustomerTable => $CustomerTable,
|
||||
},
|
||||
);
|
||||
|
||||
return {
|
||||
Output => $Output,
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
84
Perl OTRS/Kernel/Output/HTML/TicketZoom/LinkTable.pm
Normal file
84
Perl OTRS/Kernel/Output/HTML/TicketZoom/LinkTable.pm
Normal file
@@ -0,0 +1,84 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::LinkTable;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $ObjectManagerDisabled = 1;
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
# get linked objects
|
||||
my $LinkListWithData = $Kernel::OM->Get('Kernel::System::LinkObject')->LinkListWithData(
|
||||
Object => 'Ticket',
|
||||
Key => $Param{Ticket}->{TicketID},
|
||||
State => 'Valid',
|
||||
UserID => $Self->{UserID},
|
||||
ObjectParameters => {
|
||||
Ticket => {
|
||||
IgnoreLinkedTicketStateTypes => 1,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
# get link table view mode
|
||||
my $LinkTableViewMode =
|
||||
$Kernel::OM->Get('Kernel::Config')->Get('LinkObject::ViewMode');
|
||||
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
|
||||
# create the link table
|
||||
my $LinkTableStrg = $LayoutObject->LinkObjectTableCreate(
|
||||
LinkListWithData => $LinkListWithData,
|
||||
ViewMode => $LinkTableViewMode,
|
||||
Object => 'Ticket',
|
||||
Key => $Param{Ticket}->{TicketID},
|
||||
);
|
||||
return if !$LinkTableStrg;
|
||||
|
||||
my $Location = '';
|
||||
|
||||
# output the simple link table
|
||||
if ( $LinkTableViewMode eq 'Simple' ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'LinkTableSimple',
|
||||
Data => {
|
||||
LinkTableStrg => $LinkTableStrg,
|
||||
},
|
||||
);
|
||||
$Location = 'Sidebar';
|
||||
}
|
||||
|
||||
# output the complex link table
|
||||
if ( $LinkTableViewMode eq 'Complex' ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'LinkTableComplex',
|
||||
Data => {
|
||||
LinkTableStrg => $LinkTableStrg,
|
||||
},
|
||||
);
|
||||
$Location = 'Main';
|
||||
}
|
||||
|
||||
my $Output = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketZoom/LinkTable',
|
||||
Data => {},
|
||||
);
|
||||
return {
|
||||
Location => $Location,
|
||||
Output => $Output,
|
||||
Rank => '0300',
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
492
Perl OTRS/Kernel/Output/HTML/TicketZoom/TicketInformation.pm
Normal file
492
Perl OTRS/Kernel/Output/HTML/TicketZoom/TicketInformation.pm
Normal file
@@ -0,0 +1,492 @@
|
||||
# --
|
||||
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
|
||||
# --
|
||||
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
|
||||
# the enclosed file COPYING for license information (GPL). If you
|
||||
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
|
||||
# --
|
||||
|
||||
package Kernel::Output::HTML::TicketZoom::TicketInformation;
|
||||
|
||||
use parent 'Kernel::Output::HTML::Base';
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Kernel::Language qw(Translatable);
|
||||
use Kernel::System::VariableCheck qw(IsHashRefWithData);
|
||||
|
||||
our $ObjectManagerDisabled = 1;
|
||||
|
||||
sub Run {
|
||||
my ( $Self, %Param ) = @_;
|
||||
|
||||
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
|
||||
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
|
||||
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
|
||||
my $UserObject = $Kernel::OM->Get('Kernel::System::User');
|
||||
|
||||
my %Ticket = %{ $Param{Ticket} };
|
||||
my %AclAction = %{ $Param{AclAction} };
|
||||
|
||||
# Show created by name, if different then root user (ID=1).
|
||||
if ( $Ticket{CreateBy} > 1 ) {
|
||||
$Ticket{CreatedByUser} = $UserObject->UserName( UserID => $Ticket{CreateBy} );
|
||||
$LayoutObject->Block(
|
||||
Name => 'CreatedBy',
|
||||
Data => {%Ticket},
|
||||
);
|
||||
}
|
||||
|
||||
if ( $Ticket{ArchiveFlag} eq 'y' ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'ArchiveFlag',
|
||||
Data => { %Ticket, %AclAction },
|
||||
);
|
||||
}
|
||||
|
||||
# ticket type
|
||||
if ( $ConfigObject->Get('Ticket::Type') ) {
|
||||
|
||||
my %Type = $Kernel::OM->Get('Kernel::System::Type')->TypeGet(
|
||||
ID => $Ticket{TypeID},
|
||||
);
|
||||
|
||||
$LayoutObject->Block(
|
||||
Name => 'Type',
|
||||
Data => {
|
||||
Valid => $Type{ValidID},
|
||||
%Ticket,
|
||||
%AclAction
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
# ticket service
|
||||
if ( $ConfigObject->Get('Ticket::Service') && $Ticket{Service} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'Service',
|
||||
Data => { %Ticket, %AclAction },
|
||||
);
|
||||
if ( $Ticket{SLA} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'SLA',
|
||||
Data => { %Ticket, %AclAction },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# show first response time if needed
|
||||
if ( defined $Ticket{FirstResponseTime} ) {
|
||||
$Ticket{FirstResponseTimeHuman} = $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{FirstResponseTime},
|
||||
TimeShowAlwaysLong => 1,
|
||||
Space => ' ',
|
||||
);
|
||||
$Ticket{FirstResponseTimeWorkingTime} = $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{FirstResponseTimeWorkingTime},
|
||||
TimeShowAlwaysLong => 1,
|
||||
Space => ' ',
|
||||
);
|
||||
if ( 60 * 60 * 1 > $Ticket{FirstResponseTime} ) {
|
||||
$Ticket{FirstResponseTimeClass} = 'Warning';
|
||||
}
|
||||
$LayoutObject->Block(
|
||||
Name => 'FirstResponseTime',
|
||||
Data => { %Ticket, %AclAction },
|
||||
);
|
||||
}
|
||||
|
||||
# show update time if needed
|
||||
if ( defined $Ticket{UpdateTime} ) {
|
||||
$Ticket{UpdateTimeHuman} = $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{UpdateTime},
|
||||
TimeShowAlwaysLong => 1,
|
||||
Space => ' ',
|
||||
);
|
||||
$Ticket{UpdateTimeWorkingTime} = $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{UpdateTimeWorkingTime},
|
||||
TimeShowAlwaysLong => 1,
|
||||
Space => ' ',
|
||||
);
|
||||
if ( 60 * 60 * 1 > $Ticket{UpdateTime} ) {
|
||||
$Ticket{UpdateTimeClass} = 'Warning';
|
||||
}
|
||||
$LayoutObject->Block(
|
||||
Name => 'UpdateTime',
|
||||
Data => { %Ticket, %AclAction },
|
||||
);
|
||||
}
|
||||
|
||||
# show solution time if needed
|
||||
if ( defined $Ticket{SolutionTime} ) {
|
||||
$Ticket{SolutionTimeHuman} = $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{SolutionTime},
|
||||
TimeShowAlwaysLong => 1,
|
||||
Space => ' ',
|
||||
);
|
||||
$Ticket{SolutionTimeWorkingTime} = $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{SolutionTimeWorkingTime},
|
||||
TimeShowAlwaysLong => 1,
|
||||
Space => ' ',
|
||||
);
|
||||
if ( 60 * 60 * 1 > $Ticket{SolutionTime} ) {
|
||||
$Ticket{SolutionTimeClass} = 'Warning';
|
||||
}
|
||||
$LayoutObject->Block(
|
||||
Name => 'SolutionTime',
|
||||
Data => { %Ticket, %AclAction },
|
||||
);
|
||||
}
|
||||
|
||||
# show number of tickets with the same customer id if feature is active:
|
||||
if ( $ConfigObject->Get('Ticket::Frontend::ZoomCustomerTickets') ) {
|
||||
if ( $Ticket{CustomerID} ) {
|
||||
$Ticket{CustomerIDTickets} = $TicketObject->TicketSearch(
|
||||
CustomerID => $Ticket{CustomerID},
|
||||
Result => 'COUNT',
|
||||
Permission => 'ro',
|
||||
UserID => $Self->{UserID},
|
||||
);
|
||||
$LayoutObject->Block(
|
||||
Name => 'CustomerIDTickets',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# show total accounted time if feature is active:
|
||||
if ( $ConfigObject->Get('Ticket::Frontend::AccountTime') ) {
|
||||
$Ticket{TicketTimeUnits} = $TicketObject->TicketAccountedTimeGet(%Ticket);
|
||||
$LayoutObject->Block(
|
||||
Name => 'TotalAccountedTime',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
}
|
||||
|
||||
# show pending until, if set:
|
||||
if ( $Ticket{UntilTime} ) {
|
||||
if ( $Ticket{UntilTime} < -1 ) {
|
||||
$Ticket{PendingUntilClass} = 'Warning';
|
||||
}
|
||||
|
||||
my $CurSysDTObject = $Kernel::OM->Create('Kernel::System::DateTime');
|
||||
$Ticket{UntilTimeHuman} = $Kernel::OM->Create(
|
||||
'Kernel::System::DateTime',
|
||||
ObjectParams => {
|
||||
Epoch => ( $Ticket{UntilTime} + $CurSysDTObject->ToEpoch() ),
|
||||
},
|
||||
)->ToString();
|
||||
|
||||
$Ticket{PendingUntil} .= $LayoutObject->CustomerAge(
|
||||
Age => $Ticket{UntilTime},
|
||||
Space => ' '
|
||||
);
|
||||
$LayoutObject->Block(
|
||||
Name => 'PendingUntil',
|
||||
Data => \%Ticket,
|
||||
);
|
||||
}
|
||||
|
||||
# Check if agent has permission to start chats with agents.
|
||||
my $EnableChat = 1;
|
||||
my $ChatStartingAgentsGroup = $ConfigObject->Get('ChatEngine::PermissionGroup::ChatStartingAgents') || 'users';
|
||||
my $ChatReceivingAgentsGroup = $ConfigObject->Get('ChatEngine::PermissionGroup::ChatReceivingAgents') || 'users';
|
||||
my $ChatStartingAgentsGroupPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $ChatStartingAgentsGroup,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
if ( !$ConfigObject->Get('ChatEngine::Active') || !$ChatStartingAgentsGroupPermission ) {
|
||||
$EnableChat = 0;
|
||||
}
|
||||
if (
|
||||
$EnableChat
|
||||
&& !$ConfigObject->Get('ChatEngine::ChatDirection::AgentToAgent')
|
||||
)
|
||||
{
|
||||
$EnableChat = 0;
|
||||
}
|
||||
|
||||
my %OnlineData;
|
||||
if ($EnableChat) {
|
||||
my $VideoChatEnabled = 0;
|
||||
my $VideoChatAgentsGroup = $ConfigObject->Get('ChatEngine::PermissionGroup::VideoChatAgents') || 'users';
|
||||
my $VideoChatAgentsGroupPermission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
|
||||
UserID => $Self->{UserID},
|
||||
GroupName => $VideoChatAgentsGroup,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
# Enable the video chat feature if system is entitled and agent is a member of configured group.
|
||||
if ( $ConfigObject->Get('ChatEngine::Active') && $VideoChatAgentsGroupPermission ) {
|
||||
if ( $Kernel::OM->Get('Kernel::System::Main')->Require( 'Kernel::System::VideoChat', Silent => 1 ) ) {
|
||||
$VideoChatEnabled = $Kernel::OM->Get('Kernel::System::VideoChat')->IsEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
FIELD:
|
||||
for my $Field (qw(OwnerID ResponsibleID)) {
|
||||
next FIELD if !$Ticket{$Field};
|
||||
next FIELD if $Field eq 'ResponsibleID' && !$ConfigObject->Get('Ticket::Responsible');
|
||||
|
||||
my $UserID = $Ticket{$Field};
|
||||
|
||||
$OnlineData{$Field}->{EnableChat} = $EnableChat;
|
||||
$OnlineData{$Field}->{AgentEnableChat} = 0;
|
||||
$OnlineData{$Field}->{ChatAccess} = 0;
|
||||
$OnlineData{$Field}->{VideoChatAvailable} = 0;
|
||||
$OnlineData{$Field}->{VideoChatSupport} = 0;
|
||||
$OnlineData{$Field}->{VideoChatEnabled} = $VideoChatEnabled;
|
||||
|
||||
# Default status is offline.
|
||||
$OnlineData{$Field}->{UserState} = Translatable('Offline');
|
||||
$OnlineData{$Field}->{UserStateDescription}
|
||||
= $LayoutObject->{LanguageObject}->Translate('User is currently offline.');
|
||||
|
||||
# We also need to check if the receiving agent has chat permissions.
|
||||
my %UserGroups = $Kernel::OM->Get('Kernel::System::Group')->PermissionUserGet(
|
||||
UserID => $UserID,
|
||||
Type => 'rw',
|
||||
);
|
||||
|
||||
my %UserGroupsReverse = reverse %UserGroups;
|
||||
$OnlineData{$Field}->{ChatAccess} = $UserGroupsReverse{$ChatReceivingAgentsGroup} ? 1 : 0;
|
||||
|
||||
my %User = $UserObject->GetUserData(
|
||||
UserID => $UserID,
|
||||
);
|
||||
$OnlineData{$Field}->{VideoChatSupport} = $User{VideoChatHasWebRTC};
|
||||
|
||||
# Check agent's availability.
|
||||
if ( $OnlineData{$Field}->{ChatAccess} ) {
|
||||
$OnlineData{$Field}->{AgentChatAvailability}
|
||||
= $Kernel::OM->Get('Kernel::System::Chat')->AgentAvailabilityGet(
|
||||
UserID => $UserID,
|
||||
External => 0,
|
||||
);
|
||||
|
||||
if ( $OnlineData{$Field}->{AgentChatAvailability} == 3 ) {
|
||||
$OnlineData{$Field}->{UserState} = Translatable('Active');
|
||||
$OnlineData{$Field}->{AgentEnableChat} = 1;
|
||||
$OnlineData{$Field}->{UserStateDescription}
|
||||
= $LayoutObject->{LanguageObject}->Translate('User is currently active.');
|
||||
$OnlineData{$Field}->{VideoChatAvailable} = 1;
|
||||
}
|
||||
elsif ( $OnlineData{$Field}->{AgentChatAvailability} == 2 ) {
|
||||
$OnlineData{$Field}->{UserState} = Translatable('Away');
|
||||
$OnlineData{$Field}->{AgentEnableChat} = 1;
|
||||
$OnlineData{$Field}->{UserStateDescription}
|
||||
= $LayoutObject->{LanguageObject}->Translate('User was inactive for a while.');
|
||||
}
|
||||
elsif ( $OnlineData{$Field}->{AgentChatAvailability} == 1 ) {
|
||||
$OnlineData{$Field}->{UserState} = Translatable('Unavailable');
|
||||
$OnlineData{$Field}->{UserStateDescription}
|
||||
= $LayoutObject->{LanguageObject}->Translate('User set their status to unavailable.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# owner info
|
||||
my %OwnerInfo = $UserObject->GetUserData(
|
||||
UserID => $Ticket{OwnerID},
|
||||
);
|
||||
$LayoutObject->Block(
|
||||
Name => 'Owner',
|
||||
Data => { %Ticket, %OwnerInfo, %AclAction, %{ $OnlineData{OwnerID} // {} } },
|
||||
);
|
||||
|
||||
if ( $ConfigObject->Get('Ticket::Responsible') ) {
|
||||
|
||||
# show responsible
|
||||
my %ResponsibleInfo = $UserObject->GetUserData(
|
||||
UserID => $Ticket{ResponsibleID} || 1,
|
||||
);
|
||||
|
||||
$LayoutObject->Block(
|
||||
Name => 'Responsible',
|
||||
Data => { %Ticket, %ResponsibleInfo, %AclAction, %{ $OnlineData{ResponsibleID} // {} } },
|
||||
);
|
||||
}
|
||||
|
||||
# set display options
|
||||
$Param{WidgetTitle} = Translatable('Ticket Information');
|
||||
$Param{Hook} = $ConfigObject->Get('Ticket::Hook') || 'Ticket#';
|
||||
|
||||
# check if ticket is normal or process ticket
|
||||
my $IsProcessTicket = $Kernel::OM->Get('Kernel::System::Ticket')->TicketCheckForProcessType(
|
||||
TicketID => $Ticket{TicketID}
|
||||
);
|
||||
|
||||
# get zoom settings depending on ticket type
|
||||
$Self->{DisplaySettings} = $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom");
|
||||
|
||||
# overwrite display options for process ticket
|
||||
if ($IsProcessTicket) {
|
||||
$Param{WidgetTitle} = $Self->{DisplaySettings}->{ProcessDisplay}->{WidgetTitle};
|
||||
|
||||
# get the DF where the ProcessEntityID is stored
|
||||
my $ProcessEntityIDField = 'DynamicField_'
|
||||
. $ConfigObject->Get("Process::DynamicFieldProcessManagementProcessID");
|
||||
|
||||
# get the DF where the AtivityEntityID is stored
|
||||
my $ActivityEntityIDField = 'DynamicField_'
|
||||
. $ConfigObject->Get("Process::DynamicFieldProcessManagementActivityID");
|
||||
|
||||
my $ProcessData = $Kernel::OM->Get('Kernel::System::ProcessManagement::Process')->ProcessGet(
|
||||
ProcessEntityID => $Ticket{$ProcessEntityIDField},
|
||||
);
|
||||
my $ActivityData = $Kernel::OM->Get('Kernel::System::ProcessManagement::Activity')->ActivityGet(
|
||||
Interface => 'AgentInterface',
|
||||
ActivityEntityID => $Ticket{$ActivityEntityIDField},
|
||||
);
|
||||
|
||||
# output process information in the sidebar
|
||||
$LayoutObject->Block(
|
||||
Name => 'ProcessData',
|
||||
Data => {
|
||||
Process => $ProcessData->{Name} || '',
|
||||
Activity => $ActivityData->{Name} || '',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
# get dynamic field config for frontend module
|
||||
my $DynamicFieldFilter = {
|
||||
%{ $ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")->{DynamicField} || {} },
|
||||
%{
|
||||
$ConfigObject->Get("Ticket::Frontend::AgentTicketZoom")
|
||||
->{ProcessWidgetDynamicField}
|
||||
|| {}
|
||||
},
|
||||
};
|
||||
|
||||
# get the dynamic fields for ticket object
|
||||
my $DynamicField = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldListGet(
|
||||
Valid => 1,
|
||||
ObjectType => ['Ticket'],
|
||||
FieldFilter => $DynamicFieldFilter || {},
|
||||
);
|
||||
my $DynamicFieldBeckendObject = $Kernel::OM->Get('Kernel::System::DynamicField::Backend');
|
||||
|
||||
# to store dynamic fields to be displayed in the process widget and in the sidebar
|
||||
my (@FieldsSidebar);
|
||||
|
||||
# cycle trough the activated Dynamic Fields for ticket object
|
||||
DYNAMICFIELD:
|
||||
for my $DynamicFieldConfig ( @{$DynamicField} ) {
|
||||
next DYNAMICFIELD if !IsHashRefWithData($DynamicFieldConfig);
|
||||
next DYNAMICFIELD if !defined $Ticket{ 'DynamicField_' . $DynamicFieldConfig->{Name} };
|
||||
next DYNAMICFIELD if $Ticket{ 'DynamicField_' . $DynamicFieldConfig->{Name} } eq '';
|
||||
|
||||
# Check if this field is supposed to be hidden from the ticket information box.
|
||||
# For example, it's displayed by a different mechanism (i.e. async widget).
|
||||
if (
|
||||
$DynamicFieldBeckendObject->HasBehavior(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
Behavior => 'IsHiddenInTicketInformation',
|
||||
)
|
||||
)
|
||||
{
|
||||
next DYNAMICFIELD;
|
||||
}
|
||||
|
||||
# use translation here to be able to reduce the character length in the template
|
||||
my $Label = $LayoutObject->{LanguageObject}->Translate( $DynamicFieldConfig->{Label} );
|
||||
|
||||
my $ValueStrg = $DynamicFieldBeckendObject->DisplayValueRender(
|
||||
DynamicFieldConfig => $DynamicFieldConfig,
|
||||
Value => $Ticket{ 'DynamicField_' . $DynamicFieldConfig->{Name} },
|
||||
LayoutObject => $LayoutObject,
|
||||
ValueMaxChars => $ConfigObject->
|
||||
Get('Ticket::Frontend::DynamicFieldsZoomMaxSizeSidebar')
|
||||
|| 18, # limit for sidebar display
|
||||
);
|
||||
|
||||
if ( $Self->{DisplaySettings}->{DynamicField}->{ $DynamicFieldConfig->{Name} } ) {
|
||||
push @FieldsSidebar, {
|
||||
$DynamicFieldConfig->{Name} => $ValueStrg->{Title},
|
||||
Name => $DynamicFieldConfig->{Name},
|
||||
Title => $ValueStrg->{Title},
|
||||
Value => $ValueStrg->{Value},
|
||||
Label => $Label,
|
||||
Link => $ValueStrg->{Link},
|
||||
LinkPreview => $ValueStrg->{LinkPreview},
|
||||
|
||||
# Include unique parameter with dynamic field name in case of collision with others.
|
||||
# Please see bug#13362 for more information.
|
||||
"DynamicField_$DynamicFieldConfig->{Name}" => $ValueStrg->{Title},
|
||||
};
|
||||
}
|
||||
|
||||
# example of dynamic fields order customization
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketDynamicField_' . $DynamicFieldConfig->{Name},
|
||||
Data => {
|
||||
Label => $Label,
|
||||
},
|
||||
);
|
||||
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketDynamicField_' . $DynamicFieldConfig->{Name} . '_Plain',
|
||||
Data => {
|
||||
Value => $ValueStrg->{Value},
|
||||
Title => $ValueStrg->{Title},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
# output dynamic fields in the sidebar
|
||||
for my $Field (@FieldsSidebar) {
|
||||
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketDynamicField',
|
||||
Data => {
|
||||
Label => $Field->{Label},
|
||||
},
|
||||
);
|
||||
|
||||
if ( $Field->{Link} ) {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketDynamicFieldLink',
|
||||
Data => {
|
||||
$Field->{Name} => $Field->{Title},
|
||||
%Ticket,
|
||||
|
||||
# alias for ticket title, Title will be overwritten
|
||||
TicketTitle => $Ticket{Title},
|
||||
Value => $Field->{Value},
|
||||
Title => $Field->{Title},
|
||||
Link => $Field->{Link},
|
||||
LinkPreview => $Field->{LinkPreview},
|
||||
|
||||
# Include unique parameter with dynamic field name in case of collision with others.
|
||||
# Please see bug#13362 for more information.
|
||||
"DynamicField_$Field->{Name}" => $Field->{Title},
|
||||
},
|
||||
);
|
||||
}
|
||||
else {
|
||||
$LayoutObject->Block(
|
||||
Name => 'TicketDynamicFieldPlain',
|
||||
Data => {
|
||||
Value => $Field->{Value},
|
||||
Title => $Field->{Title},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
my $Output = $LayoutObject->Output(
|
||||
TemplateFile => 'AgentTicketZoom/TicketInformation',
|
||||
Data => { %Param, %Ticket, %AclAction },
|
||||
);
|
||||
|
||||
return {
|
||||
Output => $Output,
|
||||
};
|
||||
}
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user