
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.