Hi,
Another post for another problem, I think this one is not so hard but I don't find any solution in others topics.
I'm programming PHP API for OTRS. So I'm my customers will be able to create a new ticket trought php.
But before creating the first customer ticket, I need to clone customer informations from my database website.
So after verifying the customer is not "know" by OTRS (done with php / mysql with the customer_user table (id)), I'm creating new entry with SOAP and php, here is my code : (from a homemade php class)
Code: Select all
public function create_otrs_user(){
global $c_infos;
global $c_address;
$pays = "France";
$rdmNumber = rand(1, 9999);
$rdmLogin = "utilisateur_".$rdmNumber;
// Vérif que le login insérer dans la bdd otrs est unique
function isUniqueLogin($rdmLogin){
$check_rdm = mysql_query("SELECT login FROM customer_user WHERE login='".$rdmLogin."'");
if (!tep_db_num_rows($check_rdm)) return true;
else return false;
}
while(!isUniqueLogin($rdmLogin)){
$rdmNumber +=1;
$rdmLogin = "utilisateur_".$rdmNumber;
}
/* ---------- */
$otrs_user_login = $this->soapclient->__soapCall("Dispatch", array($this->user, $this->pass,
"CustomerUserObject", "CustomerUserAdd",
"Source", 'CustomerUser', # CustomerUser source config
"UserFirstname", utf8_encode($c_infos['customers_firstname']),
"UserLastname", utf8_encode($c_infos['customers_lastname']),
"UserCustomerID", utf8_encode($c_infos['customers_id']),
"UserLogin", utf8_encode($rdmLogin),
"UserEmail", utf8_encode($c_infos['customers_email_address']),
"UserPhone", utf8_encode($c_infos['customers_telephone']),
"UserFax", utf8_encode($c_infos['customers_fax']),
"UserMobile", utf8_encode($c_infos['customers_telephone']),
"UserStreet", utf8_encode($c_address['entry_street_adress']),
"UserZip", utf8_encode($c_address['entry_postcode']),
"UserCity", utf8_encode($c_address['entry_city']),
"UserCountry", utf8_encode($pays),
"ValidID", 1,
"UserID", 1,
));
}
I need to get customers informations In OTRS, for my agents.
What is the probleme here? Thanks a lot (please move topic if needed)