CreateTicket2-n.pl perl ticket interface OTRS 2.2.3

Hello Dev's, I have been trawling the lists and google to find a
solution to my problem but have been unable to find anything to get me
further than I am.
I found this script on the dev list from a while back and I have been
trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl.
The script is exactly where I need to start to help integrate the OTRS
system into our workflow here.
The script is shown below but the error message when I run it from
/opt/otrs/bin/CreateTickets2-n.pl is:
[853232650@localhost bin]$ pwd
/opt/otrs/bin
[853232650@localhost bin]$ ./CreateTicket2-n.pl
Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT>
line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to
where to proceed. The CVS public API seems very straight forward but I
cant get past the very basic point where I am. Any pointers as to how
to create a basic ticket with article from Perl using the API would be
very appreciated.
Thanks for your help
#!/usr/bin/perl -w
# --
# create ticket with an article
# Copyright (C)
# --
# $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
use File::Basename;
use FindBin qw($RealBin);
use lib dirname($RealBin);
use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config;
use Kernel::System::Time;
use Kernel::System::Log;
use Kernel::System::DB;
use Kernel::System::Ticket;
my $ConfigObject = Kernel::Config->new();
my $TimeObject = Kernel::System::Time->new(
ConfigObject => $ConfigObject,
);
my $LogObject = Kernel::System::Log->new(
ConfigObject => $ConfigObject,
LogPrefix => "CreateTicket.pl",
);
my $DBObject = Kernel::System::DB->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
);
my $TicketObject = Kernel::System::Ticket->new(
ConfigObject => $ConfigObject,
LogObject => $LogObject,
DBObject => $DBObject,
TimeObject => $TimeObject,
);
my $TicketID = $TicketObject->TicketCreate(
TN => $TicketObject->TicketCreateNumber(),
Queue => 'Raw',
Lock => 'unlock',
GroupID => 1,
Priority => '3 normal',
State => 'new',
CustomerNo => '',
CustomerUser => '',
UserID => 1, # current owner
CreateUserID => 1,
);
print "Ticket (TicketID:$TicketID) created.\n";
if ($TicketID) {
my $ArticleID = $TicketObject->ArticleCreate(
TicketID => $TicketID,
ArticleType => 'note-external', #
email-external|email-internal|phone|fax|...
SenderType => 'customer', # agent|system|customer
From => 'Some Agent
Security Monitoring and Compliance Infrastructure Security Services RBC Royal Bank of Canada Tel: 416-348-4429
_______________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Hi Eric, On Nov 23, 2007, at 4:47 AM, Partington, Eric wrote:
Hello Dev's, I have been trawling the lists and google to find a solution to my problem but have been unable to find anything to get me further than I am.
I found this script on the dev list from a while back and I have been trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl. The script is exactly where I need to start to help integrate the OTRS system into our workflow here.
The script is shown below but the error message when I run it from / opt/otrs/bin/CreateTickets2-n.pl is: [853232650@localhost bin]$ pwd /opt/otrs/bin [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to where to proceed. The CVS public API seems very straight forward but I cant get past the very basic point where I am. Any pointers as to how to create a basic ticket with article from Perl using the API would be very appreciated.
Thanks for your help
#!/usr/bin/perl -w # -- # create ticket with an article # Copyright (C) # -- # $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see http://www.gnu.org/licenses/gpl.txt. # --
use File::Basename; use FindBin qw($RealBin); use lib dirname($RealBin); use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config; use Kernel::System::Time; use Kernel::System::Log; use Kernel::System::DB; use Kernel::System::Ticket; my $ConfigObject = Kernel::Config->new(); my $TimeObject = Kernel::System::Time->new( ConfigObject => $ConfigObject, ); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", );
Where did you find this example? There is a bug in the documentation! .-/ The TimeObject needs also the LogObject as param like: my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, ); Then it should work. Greetings, -Martin -- ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0) 9421 56818 0 :: Fax: +49 (0) 9421 56818 18 http://www.otrs.com/ :: Communication with success! Address of record: Bad Homburg Local Court: Bad Homburg, HRB 10751 Tax number: 003/240/97505 Chairman: Burchard Steinbild Chief Executive Officer: André Mindermann

Thanks for the prompt response Martin, I tried your suggestion and still have the same error that I did before. Any more suggestions? I also noticed that many of the modules are written with the $CommonObject{} format as opposed to the $method format. Is something I should be looking into? Eric [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4. The TimeObject needs also the LogObject as param like: my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, ); -----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 5:07 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3 Hi Eric, On Nov 23, 2007, at 4:47 AM, Partington, Eric wrote:
Hello Dev's, I have been trawling the lists and google to find a solution to my problem but have been unable to find anything to get me further than I am.
I found this script on the dev list from a while back and I have been trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl. The script is exactly where I need to start to help integrate the OTRS system into our workflow here.
The script is shown below but the error message when I run it from / opt/otrs/bin/CreateTickets2-n.pl is: [853232650@localhost bin]$ pwd /opt/otrs/bin [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to where to proceed. The CVS public API seems very straight forward but I cant get past the very basic point where I am. Any pointers as to how to create a basic ticket with article from Perl using the API would be very appreciated.
Thanks for your help
#!/usr/bin/perl -w # -- # create ticket with an article # Copyright (C) # -- # $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see http://www.gnu.org/licenses/gpl.txt. # --
use File::Basename; use FindBin qw($RealBin); use lib dirname($RealBin); use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config; use Kernel::System::Time; use Kernel::System::Log; use Kernel::System::DB; use Kernel::System::Ticket; my $ConfigObject = Kernel::Config->new(); my $TimeObject = Kernel::System::Time->new( ConfigObject => $ConfigObject, ); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", );
Where did you find this example? There is a bug in the documentation! .-/ The TimeObject needs also the LogObject as param like: my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, ); Then it should work. Greetings, -Martin -- ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0) 9421 56818 0 :: Fax: +49 (0) 9421 56818 18 http://www.otrs.com/ :: Communication with success! Address of record: Bad Homburg Local Court: Bad Homburg, HRB 10751 Tax number: 003/240/97505 Chairman: Burchard Steinbild Chief Executive Officer: André Mindermann _______________________________________________ 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 _______________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Hi Eric, can you upload the file somewhere (so it's easier)? :) -Martin On Nov 23, 2007, at 3:04 PM, Partington, Eric wrote:
Thanks for the prompt response Martin,
I tried your suggestion and still have the same error that I did before. Any more suggestions?
I also noticed that many of the modules are written with the $CommonObject{} format as opposed to the $method format. Is something I should be looking into?
Eric
[853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );
-----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 5:07 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3
Hi Eric,
On Nov 23, 2007, at 4:47 AM, Partington, Eric wrote:
Hello Dev's, I have been trawling the lists and google to find a solution to my problem but have been unable to find anything to get me further than I am.
I found this script on the dev list from a while back and I have been trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl. The script is exactly where I need to start to help integrate the OTRS system into our workflow here.
The script is shown below but the error message when I run it from / opt/otrs/bin/CreateTickets2-n.pl is: [853232650@localhost bin]$ pwd /opt/otrs/bin [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to where to proceed. The CVS public API seems very straight forward but I cant get past the very basic point where I am. Any pointers as to how to create a basic ticket with article from Perl using the API would be very appreciated.
Thanks for your help
#!/usr/bin/perl -w # -- # create ticket with an article # Copyright (C) # -- # $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see http://www.gnu.org/licenses/gpl.txt. # --
use File::Basename; use FindBin qw($RealBin); use lib dirname($RealBin); use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config; use Kernel::System::Time; use Kernel::System::Log; use Kernel::System::DB; use Kernel::System::Ticket; my $ConfigObject = Kernel::Config->new(); my $TimeObject = Kernel::System::Time->new( ConfigObject => $ConfigObject, ); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", );
Where did you find this example? There is a bug in the documentation! .-/
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );
Then it should work.
Greetings,
-Martin
-- ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0) 9421 56818 0 :: Fax: +49 (0) 9421 56818 18 http://www.otrs.com/ :: Communication with success!
Address of record: Bad Homburg Local Court: Bad Homburg, HRB 10751 Tax number: 003/240/97505
Chairman: Burchard Steinbild Chief Executive Officer: André Mindermann
_______________________________________________ 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 _______________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e- mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen. _______________________________________________ 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

Here is the script as it stands right now: Eric -----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 9:23 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3 Hi Eric, can you upload the file somewhere (so it's easier)? :) -Martin On Nov 23, 2007, at 3:04 PM, Partington, Eric wrote:
Thanks for the prompt response Martin,
I tried your suggestion and still have the same error that I did before. Any more suggestions?
I also noticed that many of the modules are written with the $CommonObject{} format as opposed to the $method format. Is something I should be looking into?
Eric
[853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );
-----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 5:07 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3
Hi Eric,
On Nov 23, 2007, at 4:47 AM, Partington, Eric wrote:
Hello Dev's, I have been trawling the lists and google to find a solution to my problem but have been unable to find anything to get me further than I am.
I found this script on the dev list from a while back and I have been trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl. The script is exactly where I need to start to help integrate the OTRS system into our workflow here.
The script is shown below but the error message when I run it from / opt/otrs/bin/CreateTickets2-n.pl is: [853232650@localhost bin]$ pwd /opt/otrs/bin [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to where to proceed. The CVS public API seems very straight forward but I cant get past the very basic point where I am. Any pointers as to how to create a basic ticket with article from Perl using the API would be very appreciated.
Thanks for your help
#!/usr/bin/perl -w # -- # create ticket with an article # Copyright (C) # -- # $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see http://www.gnu.org/licenses/gpl.txt. # --
use File::Basename; use FindBin qw($RealBin); use lib dirname($RealBin); use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config; use Kernel::System::Time; use Kernel::System::Log; use Kernel::System::DB; use Kernel::System::Ticket; my $ConfigObject = Kernel::Config->new(); my $TimeObject = Kernel::System::Time->new( ConfigObject => $ConfigObject, ); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", );
Where did you find this example? There is a bug in the documentation! .-/
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );
Then it should work.
Greetings,
-Martin
-- ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0) 9421 56818 0 :: Fax: +49 (0) 9421 56818 18 http://www.otrs.com/ :: Communication with success!
Address of record: Bad Homburg Local Court: Bad Homburg, HRB 10751 Tax number: 003/240/97505
Chairman: Burchard Steinbild Chief Executive Officer: André Mindermann
_______________________________________________ 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 ______________________________________________________________________ _
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e- mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen. _______________________________________________ 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
_______________________________________________ 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 _______________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Here is the file as it stands now. My system is running RHEL4 OTRS 2.2.3 This is where I found the original file from 2004. http://lists.otrs.org/pipermail/dev/2004-November/000802.html Thanks for the help everyone. Eric -----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 9:23 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3 Hi Eric, can you upload the file somewhere (so it's easier)? :) -Martin On Nov 23, 2007, at 3:04 PM, Partington, Eric wrote:
Thanks for the prompt response Martin,
I tried your suggestion and still have the same error that I did before. Any more suggestions?
I also noticed that many of the modules are written with the $CommonObject{} format as opposed to the $method format. Is something I should be looking into?
Eric
[853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );
-----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 5:07 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3
Hi Eric,
On Nov 23, 2007, at 4:47 AM, Partington, Eric wrote:
Hello Dev's, I have been trawling the lists and google to find a solution to my problem but have been unable to find anything to get me further than I am.
I found this script on the dev list from a while back and I have been trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl. The script is exactly where I need to start to help integrate the OTRS system into our workflow here.
The script is shown below but the error message when I run it from / opt/otrs/bin/CreateTickets2-n.pl is: [853232650@localhost bin]$ pwd /opt/otrs/bin [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to where to proceed. The CVS public API seems very straight forward but I cant get past the very basic point where I am. Any pointers as to how to create a basic ticket with article from Perl using the API would be very appreciated.
Thanks for your help
#!/usr/bin/perl -w # -- # create ticket with an article # Copyright (C) # -- # $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see http://www.gnu.org/licenses/gpl.txt. # --
use File::Basename; use FindBin qw($RealBin); use lib dirname($RealBin); use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config; use Kernel::System::Time; use Kernel::System::Log; use Kernel::System::DB; use Kernel::System::Ticket; my $ConfigObject = Kernel::Config->new(); my $TimeObject = Kernel::System::Time->new( ConfigObject => $ConfigObject, ); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", );
Where did you find this example? There is a bug in the documentation! .-/
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );
Then it should work.
Greetings,
-Martin
-- ((otrs)) :: OTRS AG :: Europaring 4 :: D - 94315 Straubing Fon: +49 (0) 9421 56818 0 :: Fax: +49 (0) 9421 56818 18 http://www.otrs.com/ :: Communication with success!
Address of record: Bad Homburg Local Court: Bad Homburg, HRB 10751 Tax number: 003/240/97505
Chairman: Burchard Steinbild Chief Executive Officer: André Mindermann
_______________________________________________ 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 ______________________________________________________________________ _
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e- mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen. _______________________________________________ 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
_______________________________________________ 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 _______________________________________________________________________ This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately. Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.

Hi Eric, ok. This file is using OTRS API 1.3. For OTRS 2.2 it's a little bit different. Anyway. Here is the diff and attached is a working version. Many greetings from Straubing, -Martin me@Macintosh:~/src/otrs-cvs$ diff ~/Downloads/CreateTicket2-n.pl bin/ CreateTicket 20a21
use Kernel::System::Main; 23a25,28 my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", ); 28c33,34 < my $LogObject = Kernel::System::Log->new(
my $MainObject = Kernel::System::Main->new( LogObject => $LogObject, 30d35 < LogPrefix => "CreateTicket.pl", 34a40 MainObject => $MainObject, 39a46 MainObject => $MainObject, 52,53c59,60 < UserID => 1, # current owner < CreateUserID => 1,
OwnerID => 1, # current owner UserID => 1,
me@Macintosh:~/src/otrs-cvs$ On Nov 23, 2007, at 4:50 PM, Partington, Eric wrote:
Here is the file as it stands now. My system is running RHEL4 OTRS 2.2.3
This is where I found the original file from 2004. http://lists.otrs.org/pipermail/dev/2004-November/000802.html
Thanks for the help everyone.
Eric -----Original Message----- From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Martin Edenhofer Sent: 2007, November, 23 9:23 AM To: Development community of OTRS.org Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3
Hi Eric,
can you upload the file somewhere (so it's easier)? :)
-Martin
On Nov 23, 2007, at 3:04 PM, Partington, Eric wrote:
Thanks for the prompt response Martin,
I tried your suggestion and still have the same error that I did before. Any more suggestions?
I also noticed that many of the modules are written with the $CommonObject{} format as opposed to the $method format. Is something I should be looking into?
Eric
[853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
The TimeObject needs also the LogObject as param like:
my $ConfigObject = Kernel::Config->new(); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, ); my $TimeObject = Kernel::System::Time->new( LogObject => $LogObject, ConfigObject => $ConfigObject, );

Hi Eric,
I'm currently working in the same than you. I've tried to use rpc.pl but i
cant make it work, so i tried the option of using a LWP::UserAgent
connection making a post to the Action that i want to do and it works nice.
To create a ticket you should post to AgentTicketPhone or
CustomerTicketMessage (i used the last one because our other system should
act as a "customer" of OTRS).
Hope that could be a good solution to your needs.
Greetings,
Eduardo Raffoul
2007/11/22, Partington, Eric
Hello Dev's, I have been trawling the lists and google to find a solution to my problem but have been unable to find anything to get me further than I am.
I found this script on the dev list from a while back and I have been trying to adapt it to work with OTRS 2.2.3 to create a ticket via perl. The script is exactly where I need to start to help integrate the OTRS system into our workflow here.
The script is shown below but the error message when I run it from /opt/otrs/bin/CreateTickets2-n.pl is: [853232650@localhost bin]$ pwd /opt/otrs/bin [853232650@localhost bin]$ ./CreateTicket2-n.pl Got no LogObject! at /opt/otrs/Kernel/System/Time.pm line 70, <PRODUCT> line 4.
-rwxrwxr-x 1 apache apache 2657 Nov 22 21:27 CreateTicket2-n.pl
I am sure the thing I am missing is very simple but I am at a loss as to where to proceed. The CVS public API seems very straight forward but I cant get past the very basic point where I am. Any pointers as to how to create a basic ticket with article from Perl using the API would be very appreciated.
Thanks for your help
#!/usr/bin/perl -w # -- # create ticket with an article # Copyright (C) # -- # $Id: otrs.addUser,v 1.8 2003/03/06 22:11:59 martin Exp $ # -- # This software comes with ABSOLUTELY NO WARRANTY. For details, see # the enclosed file COPYING for license information (GPL). If you # did not receive this file, see *http://www.gnu.org/licenses/gpl.txt*http://www.gnu.org/licenses/gpl.txt . # --
use *File::Basename*; use FindBin qw($RealBin); use lib dirname($RealBin); use lib dirname($RealBin)."/Kernel/cpan-lib";
use Kernel::Config; use Kernel::System::Time; use Kernel::System::Log; use Kernel::System::DB; use Kernel::System::Ticket; my $ConfigObject = Kernel::Config->new(); my $TimeObject = Kernel::System::Time->new( ConfigObject => $ConfigObject, ); my $LogObject = Kernel::System::Log->new( ConfigObject => $ConfigObject, LogPrefix => "CreateTicket.pl", ); my $DBObject = Kernel::System::DB->new( ConfigObject => $ConfigObject, LogObject => $LogObject, ); my $TicketObject = Kernel::System::Ticket->new( ConfigObject => $ConfigObject, LogObject => $LogObject, DBObject => $DBObject, TimeObject => $TimeObject, );
my $TicketID = $TicketObject->TicketCreate( TN => $TicketObject->TicketCreateNumber(), Queue => 'Raw', Lock => 'unlock', GroupID => 1, Priority => '3 normal', State => 'new', CustomerNo => '', CustomerUser => '', UserID => 1, # current owner CreateUserID => 1, ); print "Ticket (TicketID:$TicketID) created.\n";
if ($TicketID) { my $ArticleID = $TicketObject->ArticleCreate( TicketID => $TicketID, ArticleType => 'note-external', # email-external|email-internal|phone|fax|... SenderType => 'customer', # agent|system|customer From => 'Some Agent
', # not required but useful To => 'Some Customer A ', # not required but useful Cc => 'Some Customer B ', # not required but useful Subject => 'some short description', # required Body => 'the message text', # required ContentType => 'text/plain; charset=ISO-8859-15', HistoryType => 'EmailCustomer', # EmailCustomer|Move|AddNote|PriorityUpdate|WebRequestCustomer|... HistoryComment => 'Some free text!', UserID => 1, ); print "Article (ArticleID:$ArticleID) aded to TicketID $TicketID.\n"; } exit (0);
Security Monitoring and Compliance Infrastructure Security Services RBC Royal Bank of Canada Tel: 416-348-4429
_______________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does not waive any related rights and obligations. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. If you received this e-mail in error, please advise me (by return e-mail or otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser immédiatement, par retour de courrier électronique ou par un autre moyen.
_______________________________________________ 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

I finally got it working as a perl script. Not sure why I had to code it the way I did but here is the script. rename the file to .pl after downloading the zipped file and rename .txt
the script placed in the bin directory will create a ticket with the paramaters hard-coded into it. I am continuing to develop this to allow pulls from SQL database to create tickets and add attachments.
thanks for the excellent product.
Eric
________________________________
From: dev-bounces@otrs.org [mailto:dev-bounces@otrs.org] On Behalf Of Eduardo Raffoul
Sent: 2007, November, 23 9:35 AM
To: Development community of OTRS.org
Subject: Re: [dev] CreateTicket2-n.pl perl ticket interface OTRS 2.2.3
Hi Eric,
I'm currently working in the same than you. I've tried to use rpc.pl but i cant make it work, so i tried the option of using a LWP::UserAgent connection making a post to the Action that i want to do and it works nice. To create a ticket you should post to AgentTicketPhone or CustomerTicketMessage (i used the last one because our other system should act as a "customer" of OTRS).
Hope that could be a good solution to your needs.
Greetings,
Eduardo Raffoul
2007/11/22, Partington, Eric
participants (3)
-
Eduardo Raffoul
-
Martin Edenhofer
-
Partington, Eric