Skip to content

Instantly share code, notes, and snippets.

@reneeb
Last active April 19, 2016 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reneeb/77f4eb6a8d030f92a3421c2e20dbea9c to your computer and use it in GitHub Desktop.
Save reneeb/77f4eb6a8d030f92a3421c2e20dbea9c to your computer and use it in GitHub Desktop.
# --
# Copyright (C) 2001-2016 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::System::Ticket::Event::ForceUnlockNew;
use strict;
use warnings;
our @ObjectDependencies = (
'Kernel::System::Log',
'Kernel::System::Ticket',
'Kernel::System::Web::Request',
);
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# check needed stuff
for (qw(Data Event Config)) {
if ( !$Param{$_} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $_!"
);
return;
}
}
for (qw(TicketID)) {
if ( !$Param{Data}->{$_} ) {
$Kernel::OM->Get('Kernel::System::Log')->Log(
Priority => 'error',
Message => "Need $_ in Data!"
);
return;
}
}
my $NewOwner = $Kernel::OM->Get('Kernel::System::Web::Request')->GetParam( Param => 'NewOwnerID' );
return 1 if $NewOwner;
# unlock ticket
$Kernel::OM->Get('Kernel::System::Ticket')->TicketLockSet(
TicketID => $Param{Data}->{TicketID},
Lock => 'unlock',
SendNoNotification => 1,
UserID => 1,
);
return 1;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment