/usr/share/otrs/Kernel/Modules/AgentSplitSelection.pm is in otrs2 6.0.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | # --
# Copyright (C) 2001-2018 OTRS AG, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::Modules::AgentSplitSelection;
use strict;
use warnings;
use Mail::Address;
our $ObjectManagerDisabled = 1;
use Kernel::Language qw(Translatable);
use Kernel::System::VariableCheck qw(:all);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# get needed objects
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $ParamObject = $Kernel::OM->Get('Kernel::System::Web::Request');
my $LayoutObject = $Kernel::OM->Get('Kernel::Output::HTML::Layout');
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');
# get the split related parameters
$Param{TicketID} = $ParamObject->GetParam( Param => 'TicketID' );
$Param{ArticleID} = $ParamObject->GetParam( Param => 'ArticleID' );
$Param{LinkTicketID} = $ParamObject->GetParam( Param => 'LinkTicketID' );
$Param{SplitSelection} = $ParamObject->GetParam( Param => 'SplitSelection' ) || 0;
# validation
for my $Needed (qw(TicketID ArticleID LinkTicketID)) {
if ( !$Param{$Needed} ) {
$LayoutObject->FatalError( Message => "Got no $Needed!" );
}
}
# ---------------------------------------------------------- #
# ProcessSelection
# ---------------------------------------------------------- #
if ( $Self->{Subaction} eq 'ProcessSelection' ) {
# determine the redirection target
my $RedirectAction;
my $URLExtension = '';
#
# Split Email-Ticket
#
if ( $Param{SplitSelection} eq 'EmailTicket' ) {
$RedirectAction = 'AgentTicketEmail';
$URLExtension = ";TicketID=$Param{TicketID}";
}
#
# Split Phone-Ticket
#
elsif ( $Param{SplitSelection} eq 'PhoneTicket' ) {
$RedirectAction = 'AgentTicketPhone';
$URLExtension = ";TicketID=$Param{TicketID}";
}
#
# Split Process-Ticket
#
elsif ( $Param{SplitSelection} eq 'ProcessTicket' ) {
$RedirectAction = 'AgentTicketProcess';
# check if we got a useful process id
my $ProcessEntityID = $ParamObject->GetParam( Param => 'ProcessEntityID' );
# only append the parameter if a process was selected before
if ($ProcessEntityID) {
$URLExtension = ";FirstActivityDialog=1;ProcessEntityID=$ProcessEntityID";
}
}
#
# No Split
#
else {
# got a not supported split action or nothing was selected
# return to the ticket zoom screen
return $LayoutObject->Redirect(
OP => "Action=AgentTicketZoom;TicketID=$Param{TicketID}",
);
}
# redirect to the next split screen
return $LayoutObject->Redirect(
OP =>
"Action=$RedirectAction;ArticleID=$Param{ArticleID};LinkTicketID=$Param{LinkTicketID}"
. $URLExtension,
);
}
# ---------------------------------------------------------- #
# Split Selection Dialog
# ---------------------------------------------------------- #
# build split selection the modal dialog
my %SplitSelectionContent = (
PhoneTicket => Translatable('Phone ticket'),
EmailTicket => Translatable('Email ticket'),
);
# only display process tickets if active processes are available
my $Processes = $ConfigObject->Get('Process');
if ( IsHashRefWithData($Processes) ) {
my $ProcessList = $Kernel::OM->Get('Kernel::System::ProcessManagement::Process')->ProcessList(
ProcessState => ['Active'],
Interface => ['AgentInterface'],
);
if ( IsHashRefWithData($ProcessList) ) {
# display the process ticket option
$SplitSelectionContent{ProcessTicket} = Translatable('Process ticket');
# reduce the processes based on the stored ACLs
# prepare process list for ACLs, use only entities instead of names, convert from
# P1 => Name to P1 => P1. As ACLs should work only against entities
my %ProcessListACL = map { $_ => $_ } sort keys %{$ProcessList};
# validate the ProcessList with stored ACLs
my $ACL = $TicketObject->TicketAcl(
ReturnType => 'Process',
ReturnSubType => '-',
Data => \%ProcessListACL,
UserID => $Self->{UserID},
);
if ( IsHashRefWithData($ProcessList) && $ACL ) {
# get ACL results
my %ACLData = $TicketObject->TicketAclData();
# recover process names
my %ReducedProcessList = map { $_ => $ProcessList->{$_} } sort keys %ACLData;
# replace original process list with the reduced one
$ProcessList = \%ReducedProcessList;
}
# generate selection for the single available processes
$Param{ProcessListStrg} = $LayoutObject->BuildSelection(
Data => $ProcessList,
Name => 'ProcessEntityID',
ID => 'ProcessEntityID',
Class => 'Modernize',
Sort => 'AlphanumericValue',
Translation => 0,
);
}
}
$Param{SplitSelectionStrg} = $LayoutObject->BuildSelection(
Data => \%SplitSelectionContent,
SelectedID => 'PhoneTicket',
Translation => 1,
Name => 'SplitSelection',
ID => 'SplitSelection',
Class => 'Modernize',
);
my $Output = $LayoutObject->Output(
TemplateFile => 'AgentSplitSelection',
Data => \%Param,
);
return $LayoutObject->Attachment(
ContentType => 'text/html; charset=' . $LayoutObject->{Charset},
Content => $Output || '',
Type => 'inline',
NoCache => 1,
);
}
1;
|