Thanks. I spent two days for digging google

. I throwed the whole php mess away and completely rewrote the code in perl.
I still have troubles

.
Now I can launch ArticleSend and receive the mail (create the ticket succesfully) but there is a charset conversion problem with the ticket's subject. Whatever I set it always handled as in utf8 charset.
The body is perfect.
This makes me totally crazy. I suspect it's a kind of otrs problem because I have some tickets I received external sources and if they have written in utf8 then the from field and the title field are wrong as well.
So here is my concept and code.
There is a php script calls a perl script a passes it some params. Perl script handles the request and opens a ticket in OTRS.
The relevant parts:
OTRS 2.4.7
Oracle 10g with ISO-8859-2 charset
Config.pm
$Self->{'DefaultCharset'} = 'iso-8859-2';
Apache log:
http://pastebin.com/SifxwyV8
I realy appreciate any help. Thank you in advance.
Code: Select all
#!/usr/bin/perl -w
use Encode;
use MIME::Base64;
use SOAP::Lite('autodispatch', proxy => 'http://192.168.1.10/otrs/rpc.pl',
encoding => 'iso-8859-2', trace =>'all');
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
my $User = 'api';
my $Pw = 'api';
sub create_ticket {
local ($subject,$email1,$email2,$otrs_ticket_nr,$body) = (@_);
my $RPC = Core->new() || die;
my $from = "support\@bluesystem.hu";
my $to = "sfeher\@bluesystem.hu";
my $TicketNumber = $RPC->Dispatch( $User, $Pw, 'TicketObject', 'TicketCreateNumber' );
my %TicketData = (
Title => $subject,
Queue => 'Junk',
Lock => 'unlock',
Priority => '3 normal',
State => 'new',
CustomerUser => $email1,
OwnerID => 21,
UserID => 21,
Charset => 'ISO-8859-2',
);
my $TicketID = $RPC->Dispatch( $User, $Pw, 'TicketObject', 'TicketCreate', %TicketData => 1 ) || die "$!";
my %ArticleData = (
TicketID => $TicketID,
ArticleType => "email-external",
SenderType => "agent",
From => $from,
To => $to,
Subject => "[Ticket#:".$TicketNumber."] ".$subject,
Charset => 'ISO-8859-2',
MimeType => "text/html",
Body => $body,
HistoryType => "EmailCustomer",
HistoryComment => "generated by OTRSInterface-Class",
UserID => 21,
NoAgentNotify => 0,
Loop => 0);
my $ArticleID = $RPC->Dispatch( $User, $Pw, 'TicketObject', 'ArticleCreate', %ArticleData => 1 ) || die "$!";
};
print header;
my %form;
my $subject;
my $email1;
my $email2;
my $otrs_ticket_nr;
my $body;
foreach my $p (param()) {
$form{$p} = param($p);
#print "$p = $form{$p}<br>\n";
if($p eq 'body') {
$body = $form{$p};
};
if($p eq 'subject') {
$subject=$form{$p};
};
if($p eq 'email1') {
$email1=$form{$p};
};
if($p eq 'email2') {
$email2=$form{$p};
};
if($p eq 'otrs_ticket_nr') {
$otrs_ticket_nr=$form{$p};
};
}
&create_ticket($subject,$email1,$email2,$otrs_ticket_nr,$body);
print end_html;