Created
November 13, 2015 04:52
-
-
Save Rijen/81f7ab21fdc90a08898d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Kernel::GenericInterface::Invoker::Oktell::TicketStateChange; | |
use strict; | |
use warnings; | |
use Kernel::System::VariableCheck qw(IsString IsStringWithData); | |
use Kernel::System::ObjectManager; | |
local $Kernel::OM = Kernel::System::ObjectManager->new(); | |
our $ObjectManagerDisabled = 1; | |
sub new { | |
my ( $Type, %Param ) = @_; | |
# allocate new hash for object | |
my $Self = {}; | |
bless( $Self, $Type ); | |
# check needed params | |
if ( !$Param{DebuggerObject} ) { | |
return { | |
Success => 0, | |
ErrorMessage => "Got no DebuggerObject!" | |
}; | |
} | |
$Self->{DebuggerObject} = $Param{DebuggerObject}; | |
return $Self; | |
} | |
sub PrepareRequest { | |
my ( $Self, %Param ) = @_; | |
# local $Kernel::OM = Kernel::System::ObjectManager->new(); | |
my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket'); | |
my %Ticket = $TicketObject->TicketGet( | |
TicketID => $Param{Data}->{TicketID} | |
# UserID => 123, | |
# Extended => 1, | |
); | |
return { | |
Success => 1, | |
Data => { | |
TicketID=>$Param{Data}->{TicketID}, | |
OldState=>$Param{Data}->{OldTicketData}->{StateID},#oldstatus | |
NewState=>$Ticket{StateID} | |
} | |
}; | |
} | |
sub HandleResponse { | |
my ( $Self, %Param ) = @_; | |
# if there was an error in the response, forward it | |
if ( !$Param{ResponseSuccess} ) { | |
return { | |
Success => 0, | |
ErrorMessage => $Param{ResponseErrorMessage}, | |
}; | |
} | |
return { | |
Success => 1, | |
Data => $Param{Data}, | |
}; | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment