Hi folks,
Thought I would give it a shot on this list. I got a problem with a
custom TicketCreate module that I'm working on. Basically, what I want
to do is on a TicketCreate is send a NewTicket notification to all the
agents that has selected the queue the ticket is assigned to as "My
Queues" even if the ticket was assigned an owner. Of course this is
built right into OTRS for tickets that are unlocked, but we sometimes
use OTRS to log simple tasks and assign the ticket to ourselves. So I
have this working... see below. However, the only problem that I have
is the notification itself contains no information other than the queue
it is. It's missing the customer info, the article body... all the good
stuff. I'm thinking that maybe the article has not been created yet and
it's an order thing? I'm not very Perl savvy so any help would be
greatly appreciated!
########################################################################
#################
package Kernel::System::Ticket::Event::EmailHelpDeskSuper;
use strict;
use Kernel::System::User;
use Kernel::System::Email;
use Kernel::System::Queue;
use vars qw($VERSION);
$VERSION = '$Revision: 1.4 $';
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
sub new {
my $Type = shift;
my %Param = @_;
# allocate new hash for object
my $Self = {};
bless ($Self, $Type);
# check needed objects
foreach (qw(DBObject ConfigObject LogObject TicketObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
# 0=off; 1=on;
$Self->{Debug} = $Param{Debug} || 1;
$Self->{UserObject} = Kernel::System::User->new(%Param);
$Self->{EmailObject} = Kernel::System::Email->new(%Param);
$Self->{QueueObject} = Kernel::System::Queue->new(%Param);
return $Self;
}
sub Run {
my $Self = shift;
my %Param = @_;
# get ticket data
my %Ticket = $Self->{TicketObject}->TicketGet(%Param);
# check needed stuff
foreach (qw(TicketID Event Config)) {
if (!$Param{$_}) {
$Self->{LogObject}->Log(Priority => 'error', Message =>
"Need $_!");
return;
}
}
if ($Param{Event} eq 'TicketCreate') {
my %Ticket = $Self->{TicketObject}->TicketGet(TicketID =>
$Param{TicketID});
#if ($Ticket{State} eq 'New') {
# get agentss who are sucscribed the ticket queue to the custom
queues
my @UserIDs =
$Self->{TicketObject}->GetSubscribedUserIDsByQueueID(
QueueID => $Ticket{QueueID},
);
# send each agent the a notification
foreach my $UserID (@UserIDs) {
my %User = $Self->{UserObject}->GetUserData(UserID => $UserID,
Valid => 1);
if (%User) {
# send agent notification
$Self->{TicketObject}->SendAgentNotification(
Type => 'NewTicket',
UserData => \%User,
CustomerMessageParams => \%Param,
TicketID => $Param{TicketID},
UserID => 1,
);
}
elsif ($Param{Event} eq 'MoveTicket') {
my %Ticket = $Self->{TicketObject}->TicketGet(TicketID =>
$Param{TicketID});
# do some stuff
}
}
}
return 1;
}
1;
########################################################################
##############################################
Daniel Shue
Networking Engineer
Randolph County IT Department
725 McDowell Rd
Asheboro, NC 27203
Phone: (336) 318-6399
Fax: (336) 636-7699
Daniel Shue
Networking Engineer
Randolph County IT Department
725 McDowell Rd
Asheboro, NC 27203
Phone: (336) 318-6399
Fax: (336) 636-7699
**********************************************************************
This email and any files transmitted with it are confidential and intended for
use only by the individual or entity named above. If you are not the intended
recipient or the employee or agent responsible for delivering this message to
the intended recipient, you are hereby notified that any disclosure,
dissemination, distribution, copying of this communication, or unauthorized use
is strictly prohibited. Please notify us immediately by reply email and then
delete this message from your system. Please note that any views or opinions
presented in this email are solely those of the author and do not necessarily
represent those of Randolph County Government. This email and any file
attachments have been scanned for potential viruses; however, the recipient
should check this email for the presence of viruses and/or malicious code.
Randolph County accepts no liability for any damage transmitted via this email.
_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev