- RUNNING AS A CRON JOB
- BUGS AND LIMITATIONS
- COPYRIGHT AND LICENSE
OTRS::ForwardQueue - Forwards the contents of an OTRS queue to a given email address.
use OTRS::ForwardQueue; %query = ( Queues => ['MyQueue'], States => ['new', 'open'], Locks => ['unlock'], UserID => 1, ); %options = ( ForwardTo => 'firstname.lastname@example.org', TempDir => '/tmp', HistoryComment => 'Forward to other request system', SMTP => 1, SMTPServer => 'smtp.example.org', NotifyCustomer => 1, NotifyCustomerTemplate => 'notify_customer.tt', TemplatesPath => '/usr/local/templates', Debug => 1, ); my $fq = OTRS::ForwardQueue->new('query' => \%query, 'options' => \%options); $fq->process_queue();
This module queries the Open Technology Real Services (OTRS) ticket management system for tickets matching the query provided and then forwards these tickets to an email address, closing them in OTRS.
The following functions are provided:
- new(\%query, \%options)
Produced automatically by Moose, this is the constructor for the class.
Reference to a hash which contains the query parameters. This takes the same key/value pairs as the
Kernel::System::TicketSearch, except that the
Resultvalue is always set to 'ARRAY'.
Required list of options which affect how the queue is processed.
HistoryComment(required): The comment left in the history of the ticket when it is forwarded to anther system.
TempDir(optional): Override the temporary directory used by the OTRS cache. Probably needs to be set if you are not running the module as the web server user (e.g. apache). If you get errors about file permissions, try setting this to
ForwardTo(required): The email address to forward tickets to.
DisableLocking(optional): Set to 1 to disable locking of forwarded tickets. Default behaviour is to lock tickets.
DisableHistory(optional): Set to 1 to disable leaving a comment in the history (effectively makes
HistoryCommentredundant). Default behaviour is to add a comment.
DisableClosing(optional): Set to 1 to disable closing the ticket after forwarding. Default behaviour is to mark ticket as 'closed successful'.
DisableEmail(optional): Set to 1 to disable sending any emails, which effectively prevents forwarding of tickets. Default behaviour is to send email. Included as an option to allow module users to test their code before sending out emails.
SMTP(optional): Set to 1 to use an SMTP server to send email, instead of the local MTA.
SMTPServer(optional): Host name or IP address of the SMTP server to use. Only effective if
SMTPis set to 1.
NotifyCustomer(optional): Set to 1 to create a new article on the ticket and notify the customer that it has been forwarded.
NotifyCustomerTemplate(optional): Relative filename to template for customer notification. Required if
NotifyCustomeris set to 1.
TemplatesPath(optional): Absolute path to template directory. Required if
Debug(optional): Set to 1 to print extra debugging information, such as the IDs of forwarded tickets.
Processes the queue based on the options passed in the constructor.
Perl version 5.14 or higher is required. You may be able to use the module with older versions of Perl, but this is neither tested nor supported.
This module requires the following modules:
Template - For dynamically producing the body of emails.
Although some of the above modules are used for optional features, all the dependencies must be installed as this module will attempt to import all of them.
You must also have the OTRS source installed and available via
@INC. This module has been tested with OTRS 3.2.10 and 3.3.9.
Running a script which uses this module as a cron job may require some additional tweaks. The easiest way is to create a small wrapper script to set the various library paths correctly, such as the one below:
#!/bin/bash # Set this to the absolute path to your OTRS install, so those # modules can be loaded FQ_OTRS_LIB="-I/path/to/otrs" # Comment out this line if you are not using local::lib FQ_LOCAL_LIB="-I$HOME/perl5/lib/perl5" # Change this to the path of your script /usr/bin/perl "$FQ_OTRS_LIB" "$FQ_LOCAL_LIB" /path/to/script.pl
No bugs have been reported.
Please report any bugs through the Github issue system:
Paul Waring <email@example.com>
This software is Copyright (c) 2014 by University of Manchester.
This is free software, licensed under:
The GNU Affero General Public License, Version 3, November 2007