This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
# --
# 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::ArticleAction::AgentTicketBounce;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Ticket',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# check basic conditions
if ( $Param{ChannelName} ne 'Email' ) {
return;
}
if ( $Param{Article}->{SenderType} eq 'system' ) {
return;
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketBounce};
# check Acl
return if !$Param{AclActionLookup}->{AgentTicketBounce};
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $Config = $ConfigObject->Get('Ticket::Frontend::AgentTicketBounce');
if ( $Config->{Permission} ) {
my $Ok = $TicketObject->TicketPermission(
Type => $Config->{Permission},
TicketID => $Param{Ticket}->{TicketID},
UserID => $Param{UserID},
LogNo => 1,
);
return if !$Ok;
}
if ( $Config->{RequiredLock} ) {
my $Locked = $TicketObject->TicketLockGet(
TicketID => $Param{Ticket}->{TicketID}
);
if ($Locked) {
my $AccessOk = $TicketObject->OwnerCheck(
TicketID => $Param{Ticket}->{TicketID},
OwnerID => $Param{UserID},
);
return if !$AccessOk;
}
}
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('Bounce Article to a different mail address'),
Name => Translatable('Bounce'),
Class => 'AsPopup PopupType_TicketAction',
Link =>
"Action=AgentTicketBounce;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID}",
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,210 @@
# --
# 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::ArticleAction::AgentTicketCompose;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Queue',
'Kernel::System::SystemAddress',
'Kernel::System::Ticket',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
if ( $Param{ChannelName} eq 'Internal' && $Param{Article}->{SenderType} eq 'agent' ) {
# skip notes
return;
}
if ( $Param{ChannelName} eq 'Email' && $Param{Article}->{SenderType} eq 'system' ) {
# skip email notifications
return;
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketCompose};
# check Acl
return if !$Param{AclActionLookup}->{AgentTicketCompose};
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $Config = $ConfigObject->Get('Ticket::Frontend::AgentTicketCompose');
if ( $Config->{Permission} ) {
my $Ok = $TicketObject->TicketPermission(
Type => $Config->{Permission},
TicketID => $Param{Ticket}->{TicketID},
UserID => $Param{UserID},
LogNo => 1,
);
return if !$Ok;
}
if ( $Config->{RequiredLock} ) {
my $Locked = $TicketObject->TicketLockGet(
TicketID => $Param{Ticket}->{TicketID}
);
if ($Locked) {
my $AccessOk = $TicketObject->OwnerCheck(
TicketID => $Param{Ticket}->{TicketID},
OwnerID => $Param{UserID},
);
return if !$AccessOk;
}
}
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article StandardTemplates Type UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
# get StandardResponsesStrg
# my %StandardResponseHash = %{ $Param{StandardResponses} || {} };
my %StandardResponseHash = %{ $Param{StandardTemplates}->{Answer} || {} };
# get revers StandardResponseHash because we need to sort by Values
# from %ReverseStandardResponseHash we get value of Key by %StandardResponseHash Value
# and @StandardResponseArray is created as array of hashes with elements Key and Value
my %ReverseStandardResponseHash = reverse %StandardResponseHash;
my @StandardResponseArray = map {
{
Key => $ReverseStandardResponseHash{$_},
Value => $_
}
} sort values %StandardResponseHash;
# use this array twice (also for Reply All), so copy it first
my @StandardResponseArrayReplyAll = @StandardResponseArray;
# build HTML string
my $StandardResponsesStrg = $LayoutObject->BuildSelection(
Name => 'ResponseID',
ID => 'ResponseID' . $Param{Article}->{ArticleID},
Class => 'Modernize Small',
Data => \@StandardResponseArray,
PossibleNone => 1,
);
my @MenuItems;
push @MenuItems, {
ItemType => 'Dropdown',
DropdownType => 'Reply',
StandardResponsesStrg => $StandardResponsesStrg,
Name => Translatable('Reply'),
Class => 'AsPopup PopupType_TicketAction',
Action => 'AgentTicketCompose',
FormID => 'Reply' . $Param{Article}->{ArticleID},
ResponseElementID => 'ResponseID' . $Param{Article}->{ArticleID},
Type => $Param{Type},
};
# check if reply all is needed
my $Recipients = '';
KEY:
for my $Key (qw(From To Cc)) {
next KEY if !$Param{Article}->{$Key};
if ($Recipients) {
$Recipients .= ', ';
}
$Recipients .= $Param{Article}->{$Key};
}
my $RecipientCount = 0;
if ($Recipients) {
my $EmailParser = Kernel::System::EmailParser->new(
%{$Self},
Mode => 'Standalone',
);
my @Addresses = $EmailParser->SplitAddressLine( Line => $Recipients );
ADDRESS:
for my $Address (@Addresses) {
my $Email = $EmailParser->GetEmailAddress( Email => $Address );
next ADDRESS if !$Email;
my $IsLocal = $Kernel::OM->Get('Kernel::System::SystemAddress')->SystemAddressIsLocalAddress(
Address => $Email,
);
next ADDRESS if $IsLocal;
$RecipientCount++;
}
}
if ( $RecipientCount > 1 ) {
$StandardResponsesStrg = $LayoutObject->BuildSelection(
Name => 'ResponseID',
ID => 'ResponseIDAll' . $Param{Article}->{ArticleID},
Class => 'Modernize Small',
Data => \@StandardResponseArrayReplyAll,
PossibleNone => 1,
);
push @MenuItems, {
ItemType => 'Dropdown',
DropdownType => 'Reply',
StandardResponsesStrg => $StandardResponsesStrg,
Name => Translatable('Reply All'),
Class => 'AsPopup PopupType_TicketAction',
Action => 'AgentTicketCompose',
FormID => 'ReplyAll' . $Param{Article}->{ArticleID},
ReplyAll => 1,
ResponseElementID => 'ResponseIDAll' . $Param{Article}->{ArticleID},
Type => $Param{Type},
};
}
return @MenuItems;
}
1;

View File

@@ -0,0 +1,132 @@
# --
# 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::ArticleAction::AgentTicketEmailResend;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
use Kernel::System::VariableCheck qw(IsHashRefWithData);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Log',
'Kernel::System::Ticket',
'Kernel::System::Ticket::Article',
);
sub new {
my ( $Type, %Param ) = @_;
my $Self = {};
bless( $Self, $Type );
return $Self;
}
sub CheckAccess {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# Check basic conditions.
if ( $Param{ChannelName} ne 'Email' ) {
return;
}
# Check previous article transmission status.
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(
%{ $Param{Article} },
);
my $TransmissionStatus = $ArticleBackendObject->ArticleTransmissionStatus(
ArticleID => $Param{Article}->{ArticleID},
);
return if !IsHashRefWithData($TransmissionStatus);
# Only show resend action if previous transmission failed.
if (
$TransmissionStatus->{Status}
&& $TransmissionStatus->{Status} ne 'Failed'
)
{
return;
}
my $ActionName = 'AgentTicketEmailResend';
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# Check if module is registered.
return if !$ConfigObject->Get('Frontend::Module')->{$ActionName};
# Check ACLs.
return if !$Param{AclActionLookup}->{$ActionName};
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $Config = $ConfigObject->Get("Ticket::Frontend::$ActionName");
if ( $Config->{Permission} ) {
my $Ok = $TicketObject->TicketPermission(
Type => $Config->{Permission},
TicketID => $Param{Ticket}->{TicketID},
UserID => $Param{UserID},
LogNo => 1,
);
return if !$Ok;
}
if ( $Config->{RequiredLock} ) {
my $Locked = $TicketObject->TicketLockGet(
TicketID => $Param{Ticket}->{TicketID}
);
if ($Locked) {
my $AccessOk = $TicketObject->OwnerCheck(
TicketID => $Param{Ticket}->{TicketID},
OwnerID => $Param{UserID},
);
return if !$AccessOk;
}
}
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('Resend this article'),
Name => Translatable('Resend'),
Class => 'AsPopup PopupType_TicketAction',
Link =>
"Action=AgentTicketEmailResend;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID}",
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,172 @@
# --
# 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::ArticleAction::AgentTicketForward;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
use Kernel::System::VariableCheck qw(IsHashRefWithData);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Ticket',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
if (
$Param{ChannelName} eq 'Internal'
&& $Param{Article}->{SenderType} ne 'customer'
)
{
# skip notes and notifications
return;
}
if ( $Param{ChannelName} eq 'Email' && $Param{Article}->{SenderType} eq 'system' ) {
# skip email notifications
return;
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketForward};
# check Acl
return if !$Param{AclActionLookup}->{AgentTicketForward};
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
my $Config = $ConfigObject->Get('Ticket::Frontend::AgentTicketForward');
if ( $Config->{Permission} ) {
my $Ok = $TicketObject->TicketPermission(
Type => $Config->{Permission},
TicketID => $Param{Ticket}->{TicketID},
UserID => $Param{UserID},
LogNo => 1,
);
return if !$Ok;
}
if ( $Config->{RequiredLock} ) {
my $Locked = $TicketObject->TicketLockGet(
TicketID => $Param{Ticket}->{TicketID}
);
if ($Locked) {
my $AccessOk = $TicketObject->OwnerCheck(
TicketID => $Param{Ticket}->{TicketID},
OwnerID => $Param{UserID},
);
return if !$AccessOk;
}
}
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article StandardTemplates Type UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
my @MenuItems;
if ( IsHashRefWithData( $Param{StandardTemplates}->{Forward} ) ) {
# get StandardResponsesStrg
my %StandardForwardHash = %{ $Param{StandardTemplates}->{Forward} };
# get revers @StandardForwardHash because we need to sort by Values
# from %ReverseStandarForward we get value of Key by %StandardForwardHash Value
# and @StandardForwardArray is created as array of hashes with elements Key and Value
my %ReverseStandarForward = reverse %StandardForwardHash;
my @StandardForwardArray = map {
{
Key => $ReverseStandarForward{$_},
Value => $_
}
} sort values %StandardForwardHash;
# build HTML string
my $StandardForwardsStrg = $LayoutObject->BuildSelection(
Name => 'ForwardTemplateID',
ID => 'ForwardTemplateID',
Class => 'Modernize Small',
Data => \@StandardForwardArray,
PossibleNone => 1
);
push @MenuItems, {
ItemType => 'Dropdown',
DropdownType => 'Forward',
StandardForwardsStrg => $StandardForwardsStrg,
Name => Translatable('Forward'),
Class => 'AsPopup PopupType_TicketAction',
Action => 'AgentTicketForward',
FormID => 'Forward' . $Param{Article}->{ArticleID},
ForwardElementID => 'ForwardTemplateID',
Type => $Param{Type},
};
}
else {
push @MenuItems, {
ItemType => 'Link',
Description => Translatable('Forward article via mail'),
Name => Translatable('Forward'),
Class => 'AsPopup PopupType_TicketAction',
Link =>
"Action=AgentTicketForward;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID}"
};
}
return @MenuItems;
}
1;

View File

@@ -0,0 +1,120 @@
# --
# 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::ArticleAction::AgentTicketMessageLog;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
use Kernel::System::VariableCheck qw(IsHashRefWithData);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::CommunicationLog::DB',
'Kernel::System::Log',
'Kernel::System::Group',
);
sub new {
my ( $Type, %Param ) = @_;
my $Self = {};
bless( $Self, $Type );
return $Self;
}
sub CheckAccess {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# Check basic conditions.
if ( $Param{ChannelName} ne 'Email' ) {
return;
}
my $Config = $Kernel::OM->Get('Kernel::Config')->Get('Frontend::Module')->{AdminCommunicationLog};
# Check if module is registered.
return if !$Config;
# If no group or RO group is specified, always allow access.
return 1 if !@{ $Config->{Group} || [] } && !@{ $Config->{GroupRo} || [] };
my $GroupObject = $Kernel::OM->Get('Kernel::System::Group');
# Check group access for frontend module.
my $Permission;
TYPE:
for my $Type (qw(Group GroupRo)) {
GROUP:
for my $Group ( @{ $Config->{$Type} || [] } ) {
$Permission = $GroupObject->PermissionCheck(
UserID => $Param{UserID},
GroupName => $Group,
Type => 'rw',
);
last GROUP if $Permission;
}
last TYPE if $Permission;
}
return $Permission;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $CommunicationLogDBObj = $Kernel::OM->Get(
'Kernel::System::CommunicationLog::DB',
);
my $Result = $CommunicationLogDBObj->ObjectLookupGet(
TargetObjectID => $Param{Article}->{ArticleID},
TargetObjectType => 'Article',
ObjectLogType => 'Message',
);
return if !$Result || !%{$Result};
my $ObjectLogID = $Result->{ObjectLogID};
my $CommunicationID = $Result->{CommunicationID};
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('View message log details for this article'),
Name => Translatable('Message Log'),
Link =>
"Action=AdminCommunicationLog;Subaction=Zoom;CommunicationID=$CommunicationID;ObjectLogID=$ObjectLogID"
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,91 @@
# --
# 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::ArticleAction::AgentTicketNote;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# check basic conditions
if ( $Param{ChannelName} ne 'Internal' ) {
return;
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketNote};
# check Acl
return if !$Param{AclActionLookup}->{AgentTicketNote};
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $Link = "Action=AgentTicketNote;TicketID=$Param{Ticket}->{TicketID};ReplyToArticle=$Param{Article}->{ArticleID}";
my $Description = Translatable('Reply to note');
my %MenuItem = (
ItemType => 'Link',
Description => $Description,
Name => $Description,
Class => 'AsPopup PopupType_TicketAction',
Link => $Link,
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,89 @@
# --
# 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::ArticleAction::AgentTicketPhone;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# check basic conditions
if ( $Param{ChannelName} eq 'Chat' ) {
return;
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentSplitSelection};
# check Acl
return if !$Param{AclActionLookup}->{AgentSplitSelection};
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('Split this article'),
Name => Translatable('Split'),
Class => 'SplitSelection',
Link =>
"Action=AgentTicketPhone;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID};LinkTicketID=$Param{Ticket}->{TicketID}",
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,99 @@
# --
# 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::ArticleAction::AgentTicketPlain;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Ticket',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# check basic conditions
if ( $Param{ChannelName} ne 'Email' ) {
return;
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketPlain};
return if !$ConfigObject->Get('Ticket::Frontend::PlainView');
# check Acl
return if !$Param{AclActionLookup}->{AgentTicketPlain};
my $Ok = $Kernel::OM->Get('Kernel::System::Ticket')->TicketPermission(
Type => 'ro',
TicketID => $Param{Ticket}->{TicketID},
UserID => $Param{UserID},
LogNo => 1,
);
return if !$Ok;
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('View the source for this Article'),
Name => Translatable('Plain Format'),
Class => 'AsPopup PopupType_TicketAction',
Link =>
"Action=AgentTicketPlain;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID}",
);
return ( \%MenuItem );
}
1;

View 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::ArticleAction::AgentTicketPrint;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
# optional AclActionLookup
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if module is registered
return if !$ConfigObject->Get('Frontend::Module')->{AgentTicketPrint};
# check Acl
return if !$Param{AclActionLookup}->{AgentTicketPrint};
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('Print this article'),
Name => Translatable('Print'),
Class => 'AsPopup PopupType_TicketAction',
Link =>
"Action=AgentTicketPrint;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID};ArticleNumber=$Param{Article}->{ArticleNumber}",
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,72 @@
# --
# 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::ArticleAction::GetHelpLink;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Ticket',
'Kernel::System::Ticket::Article',
);
sub new {
my ( $Type, %Param ) = @_;
my $Self = {};
bless( $Self, $Type );
return $Self;
}
sub CheckAccess {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my %MenuItem = (
ItemType => 'Link',
Description => Translatable('Contact us at sales@otrs.com'),
Name => Translatable('Get Help'),
Link => 'mailto:sales@otrs.com',
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,105 @@
# --
# 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::ArticleAction::MarkAsImportant;
use strict;
use warnings;
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::Output::HTML::Layout',
'Kernel::System::Log',
'Kernel::System::Ticket',
'Kernel::System::Ticket::Article',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
sub CheckAccess {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# check if current user is owner or responsible
if (
$Param{UserID} == $Param{Ticket}->{OwnerID}
|| (
$ConfigObject->Get('Ticket::Responsible')
&& $Param{UserID} == $Param{Ticket}->{ResponsibleID}
)
)
{
return 1;
}
return 0;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
# Check needed stuff.
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# Always use user id 1 because other users also have to see the important flag
my %ArticleFlags = $Kernel::OM->Get('Kernel::System::Ticket::Article')->ArticleFlagGet(
ArticleID => $Param{Article}->{ArticleID},
UserID => 1,
);
my $ArticleIsImportant = $ArticleFlags{Important};
my $Link
= "Action=AgentTicketZoom;Subaction=MarkAsImportant;TicketID=$Param{Ticket}->{TicketID};ArticleID=$Param{Article}->{ArticleID}";
my $Description = Translatable('Mark');
if ($ArticleIsImportant) {
$Description = Translatable('Unmark');
}
# set important menu item
my %MenuItem = (
ItemType => 'Link',
Description => $Description,
Name => $Description,
Link => $Link,
);
return ( \%MenuItem );
}
1;

View File

@@ -0,0 +1,102 @@
# --
# 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::ArticleAction::ReinstallPackageLink;
use strict;
use warnings;
use utf8;
use Kernel::Language qw(Translatable);
use Kernel::System::VariableCheck qw(IsHashRefWithData);
our @ObjectDependencies = (
'Kernel::System::CommunicationChannel',
'Kernel::System::Group',
'Kernel::System::Log',
'Kernel::System::Ticket::Article',
);
sub new {
my ( $Type, %Param ) = @_;
my $Self = {};
bless( $Self, $Type );
return $Self;
}
sub CheckAccess {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article ChannelName UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
# Check 'admin' group access.
my $Permission = $Kernel::OM->Get('Kernel::System::Group')->PermissionCheck(
UserID => $Param{UserID},
GroupName => 'admin',
Type => 'rw',
);
return if !$Permission;
return 1;
}
sub GetConfig {
my ( $Self, %Param ) = @_;
for my $Needed (qw(Ticket Article UserID)) {
if ( !$Param{$Needed} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $Needed!",
);
return;
}
}
my $ArticleBackendObject = $Kernel::OM->Get('Kernel::System::Ticket::Article')->BackendForArticle(
TicketID => $Param{Ticket}->{TicketID},
ArticleID => $Param{Article}->{ArticleID},
);
my %Article = $ArticleBackendObject->ArticleGet(
TicketID => $Param{Ticket}->{TicketID},
ArticleID => $Param{Article}->{ArticleID},
);
# Get communication channel data.
my %CommunicationChannel = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelGet(
ChannelID => $Article{CommunicationChannelID},
);
my $OTRSBusiness = $CommunicationChannel{PackageName} eq 'OTRSBusiness';
# Output either a link for OTRSBusiness or Package Manager screen.
my %MenuItem = (
ItemType => 'Link',
Description => $OTRSBusiness
? Translatable('Upgrade to OTRS Business Solution™')
: Translatable('Re-install Package'),
Name => $OTRSBusiness ? Translatable('Upgrade') : Translatable('Re-install'),
Link => $OTRSBusiness ? 'Action=AdminOTRSBusiness' : 'Action=AdminPackageManager',
Class => $OTRSBusiness ? 'OTRSBusinessRequired' : undef,
);
return ( \%MenuItem );
}
1;