Goal: we want to check when a ticket in a specific queue and with a specific subject is closed and then email a group mailbox.
Problems:
1) the ticket is closed via a webservice call without an ArticleAdd, only a TicketStateUpdate. This can't be changed.
2) OTRS 3.1 doesn't allow Generic Agent to send emails
3)the Event Based Notification can only filter on article subject if there's an article create
What I tried:
I scheduled a Generic Agent to execute a Custom Module when the correct filters are matched.
Here is the pm:
Code: Select all
#!/usr/bin/perl -w
package Kernel::System::GenericAgent::TEST;
use strict;
use warnings;
use lib "/opt/otrs";
use lib "/opt/otrs/Kernel/cpan-lib";
use lib "/opt/otrs/Custom";
use Kernel::System::Email;
my $ticketnumber = $ARGV[0];
my $ticketid = $ARGV[1];
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
# 0=off; 1=on;
$Self->{Debug} = $Param{Debug} || 0;
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my $MailTo = 'me@stuff.fake';
my $Message = 'CLOSED';
$Self->{SendmailObject}->Send(
From => 'OTRS1' . ' <'
. 'otrs1@fake.fake' . '>',
To => $MailTo,
Subject => '[Ticket#'.$ticketnumber.']CLOSED',
MimeType => 'text/plain',
Charset => 'utf-8',
Body => $Message,
Loop => 1,
);
}
Kernel::System::GenericAgent::TEST
When the GenericAgent runs I get this:
Oct 9 10:40:02 servername OTRS-otrs.GenericAgent.pl-99[29915]: [Notice][Kernel::System::GenericAgent::_JobRunTicket] Use module (Kernel::System::GenericAgent::TEST) for Ticket (99929557/1003438).
Oct 9 10:40:02 servername OTRS-otrs.GenericAgent.pl-99[29915]: [Error][Kernel::System::GenericAgent::_JobRunTicket][Line:1148]: Module Kernel/System/GenericAgent/TEST.pm not found!
What am I missing? Or is there a better way that doesn't include upgrading?