NewTicketWizard.pm
2.9 KB
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
# --
# 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.
#
# Frontend module for creating custom new ticket interfaces - SeTIC - UFSC - http://setic.ufsc.br/
# Rodrigo Gonçalves - rodrigo.g@ufsc.br
#
# Version 2015-08-01 - Support for OTRS 4.0.3
# Version 2015-06-25 - Support for HTML formatting of form fields
# Version 2017-06-16 - Support for bootstrap and logged in user identification
# Version 2017-06-20 - Code refactoring
# Version 2017-12-18 - Support for OTRS 6 and module publishing
#
# --
package Kernel::Modules::NewTicketWizard;
use strict;
use warnings;
use Kernel::System::VariableCheck qw(:all);
use Data::UUID;
our @ObjectDependencies = (
"Kernel::System::TicketWizard",
"Kernel::System::Web::Request",
"Kernel::Output::HTML::Layout",
"Kernel::Config"
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my $ParamObject = $Kernel::OM->Get("Kernel::System::Web::Request");
my $LayoutObject = $Kernel::OM->Get("Kernel::Output::HTML::Layout");
my $TicketWizard = $Kernel::OM->Get("Kernel::System::TicketWizard");
my $ConfigObject = $Kernel::OM->Get("Kernel::Config");
$LayoutObject->AddJSData(
Key => 'NewTicketWizard.Mode',
Value => "Restricted",
);
$Self->Debug("Authenticated ticket started");
$Self->Debug("Subaction => " . $ParamObject->GetParam( Param => "Subaction" ));
if ( $ParamObject->GetParam( Param => "UploadFileCmd" )) {
$Self->Debug("File upload instruction received");
return $TicketWizard->UploadFile();
} elsif ( $ParamObject->GetParam( Param => "Subaction" ) ) {
if ( $ParamObject->GetParam( Param => "Subaction" ) eq "CreateTicket" ) {
$Self->Debug("Create ticket action received");
return $TicketWizard->CreateTicket(CustomerID => $Self->{UserCustomerID},
CustomerUser => $Self->{UserLogin},
UserLogin => $Self->{UserLogin},
UserEmail => $Self->{UserEmail});
}
elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormJSON" ) {
$Self->Debug("Service form requested received");
return $TicketWizard->GetFormJSON( Public=> 0, ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
} elsif ( $ParamObject->GetParam( Param => "Subaction" ) eq "GetFormCustomProps" ) {
$Self->Debug("Service form custom properties (script) requested");
return $TicketWizard->GetFormCustomProps( Public=> 0, ServiceID => $ParamObject->GetParam( Param => "ServiceID" ) );
}
} else {
$Self->Debug("Default action - open service choosing form");
return $TicketWizard->OpenForm(Public => 0);
}
}
sub Debug {
my $Self = shift;
my $msg = shift;
$Kernel::OM->Get("Kernel::System::Log")->Log( Priority => 'debug', Message => $msg );
}
1;