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:
[EMAIL PROTECTED] bin]$ pwd
/opt/otrs/bin
[EMAIL PROTECTED] 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

Reply via email to