Hi.
We are trying to implement in one our system interface to OTRS.
We decide to use perl interface described on dev.otrs.org .
In attachment is my perl script to create TT. This ticket is created but
with many errors (second attachment) and cannot be viewed via web because
problem with ArticleID. 
Thanks 
Juraj Bobek.
____________________________________________________________________________
___________________
CreateTicket2.pl:
#!/usr/bin/perl -w

  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,
  );
  my $DBObject = Kernel::System::DB->new(
      ConfigObject => $ConfigObject,
      LogObject => $LogObject,
  );
  my $TicketObject = Kernel::System::Ticket->new(
      ConfigObject => $ConfigObject,
      LogObject => $LogObject,
      DBObject => $DBObject,
  );

  my $TicketID = $TicketObject->TicketCreate(
        TN => $TicketObject->TicketCreateNumber(),
        QueueID => 123,                # or Queue => 'SomeQueue'
        Lock => 'unlock',
        GroupID => 1,
        Priority => '3 normal'         # or PriorityID => 2,
        State => 'new',                # or StateID => 5,
        CustomerNo => '123465',
        CustomerUser => '[EMAIL PROTECTED]',
        UserID => 123, # new owner
        CreateUserID => 123,
  );
   print "Ticket added. Ticket ID  is $TicketID"; 
  
# --
exit (0);
____________________________________________________________________________
_______________
Error:

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3025
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 345
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3030
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 345
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3035
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 345
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
DBD::mysql::db do failed: You have an error in your SQL syntax.  Check the
manual that corresponds to your MySQL server version for the right syntax to
use near ' ,  , 1,  current_timestamp, 1000, current_timestamp, 1000)' at at
/opt/otrs/Kernel/System/DB.pm line 376.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: You have an error in your SQL syntax.  Check the manual that
corresponds to your MySQL server version for the right syntax to use near '
,  , 1,  current_timestamp, 1000, current_timestamp, 1000)' at, SQL: 'INSERT
INTO ticket_history  (name, history_type_id, ticket_id, article_id,
queue_id, owner_id,  priority_id, state_id, valid_id,  create_time,
create_by, change_time, change_by) VALUES ('%%200411041028%%inms%%3
normal%%new%%26', 1, 26,  0, 5, , ,  , 1,  current_timestamp, 1000,
current_timestamp, 1000)'

 Traceback (8901): 
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3048
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 345
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::TicketQueueID (v1.19) Line: 608
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3020
   Module: Kernel::System::Ticket::SetCustomerData (v1.19) Line: 878
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 353
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3025
   Module: Kernel::System::Ticket::SetCustomerData (v1.19) Line: 878
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 353
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3030
   Module: Kernel::System::Ticket::SetCustomerData (v1.19) Line: 878
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 353
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: No such TicketID (26)!

 Traceback (8901): 
   Module: Kernel::System::Ticket::TicketGet (v1.19) Line: 566
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3035
   Module: Kernel::System::Ticket::SetCustomerData (v1.19) Line: 878
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 353
   Module: ./CreateTicket2.pl (v) Line: 39

Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Ticket.pm line 3039.
DBD::mysql::db do failed: You have an error in your SQL syntax.  Check the
manual that corresponds to your MySQL server version for the right syntax to
use near ' , ,  , 1,  current_timestamp, 1000, current_timestamp, 1000)'  at
/opt/otrs/Kernel/System/DB.pm line 376.
Use of uninitialized value in concatenation (.) or string at
/opt/otrs/Kernel/System/Log.pm line 134.
ERROR: ?LogPrefix?-10 Perl: 5.8.3 OS: linux Time: Thu Nov  4 13:16:14 2004

 Message: You have an error in your SQL syntax.  Check the manual that
corresponds to your MySQL server version for the right syntax to use near '
, ,  , 1,  current_timestamp, 1000, current_timestamp, 1000)' , SQL: 'INSERT
INTO ticket_history  (name, history_type_id, ticket_id, article_id,
queue_id, owner_id,  priority_id, state_id, valid_id,  create_time,
create_by, change_time, change_by) VALUES
('%%CustomerID=1002\;[EMAIL PROTECTED];', 21, 26,
0, , , ,  , 1,  current_timestamp, 1000, current_timestamp, 1000)'

 Traceback (8901): 
   Module: Kernel::System::Ticket::HistoryAdd (v1.19) Line: 3048
   Module: Kernel::System::Ticket::SetCustomerData (v1.19) Line: 878
   Module: Kernel::System::Ticket::TicketCreate (v1.19) Line: 353
   Module: ./CreateTicket2.pl (v) Line: 39
 
 ___________________________________________
 S pozdravom (Mit freundlichem Gruß / kind regards)
 Dipl. Ing. Juraj Bobek
 Siemens Program and System Engineering s.r.o.
 IT Developer
 SMC BI ZA
 Tel.: +421(41)5055828
 Fax: +421(41)5055809
 <mailto:[EMAIL PROTECTED]>


Attachment: CreateTicket2.pl
Description: Binary data

Attachment: Error
Description: Binary data

_______________________________________________
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