# -- # 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;