Customer infos not show in otrs with php created user/ticket

Moderator: crythias

Locked
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

Customer infos not show in otrs with php created user/ticket

Post by benoitm »

Hi everybody !

I have a trouble with php created ticket :

I created new customer trought php successfully, with all information i need, copied from my website database.
After, when this customer create a new ticket inside my website (with php), the new ticket appear ok, no error in otrs log BUT when i go in the ticket trought otrs, customer informations are not filled in.
I think the ticket / article is not linked with the customer, so I have no informations show in otrs, and that is a big problem

Can you help me? thanks a lot


EDIT : question at next answer
Last edited by benoitm on 22 Mar 2011, 16:00, edited 3 times in total.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Customer not recognized with php created ticket

Post by crythias »

Describe what you've done to create the ticket, including some source code relevant to ticket creation.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

Re: Customer not recognized with php created ticket

Post by benoitm »

Ok so here is the PHP code to create ticket :

Code: Select all

function create_ticket(){
		global $title;
		global $from;
		global $c_infos;
		global $c_address;
		try{

			$this->numeroTicket = $this->soapclient->__soapCall("Dispatch", array($this->user, $this->pass, "TicketObject", "TicketCreateNumber"));
			if(! is_string($this->numeroTicket) ) $this->numeroTicket = number_format($this->numeroTicket,0, '.', '');

		
			$this->idTicket = $this->soapclient->__soapCall("Dispatch", array($this->user, $this->pass, 
				"TicketObject", "TicketCreate",
				"TN", $this->numeroTicket, 
				"Title", "[ Ticket#: ".$this->numeroTicket." ] ".$title,
				"Queue",        "Raw", 
				"Lock",         "Unlock", 
				"PriorityID",   3, 
				"State",        "new", 
				"CustomerID", utf8_encode($c_infos['customers_id']), 
				"CustomerUser", $from, 
				"OwnerID",      1, 
				"UserID",       1,
			));
			
		
			return($this->idTicket);
			
		}
		catch(SoapFault $soap_error){
			$error = true;
			$this->soap_error = $soap_error;
			echo "<hr/>".$soap_error."<hr/>";
		}
	}
	
	function create_article(){
		global $title;
		global $from;

		try{
			$this->numeroArticle = $this->soapclient->__soapCall("Dispatch", array($this->user, $this->pass, 
				"TicketObject", "ArticleCreate", 
				"TicketID", $this->idTicket, 
				"ArticleType",    "webrequest",
				"SenderType",     "customer",
				"HistoryType",    "WebRequestCustomer",
				"HistoryComment", "created from PHP",
				"From",           $from,
				"Subject",        $title,
				"ContentType",    "text/plain; charset=ISO-8859-1",
				"Body",           "This is the body",
				"UserID",         1,
				"Loop",           0,
				"AutoResponseType", 'auto reply',
				"OrigHeader", array(
						'From' => $from,
						'To' => 'Postmaster',
						'Subject' => $title,
						'Body' => "This is the body 2"
				),
			));
			return($this->numeroArticle);
		
		}
		catch(SoapFault $soap_error){
			$error = true;
			$this->soap_error = $soap_error;
			echo "<hr/>".$soap_error."<hr/>";
		}
	}
(I created a class where i make all functions I will need)
benoitm
Znuny newbie
Posts: 34
Joined: 21 Mar 2011, 10:22
Znuny Version: 3.0.6

Re: Customer not recognized with php created ticket

Post by benoitm »

OK I had found an error when creating ticket, using "UserCustomerID" instead of "CustomerID"

Yeah no another probleme and one more question :

1 : Where can we find each soap call specification for each otrs object (ex : how to know "UserCustomerID" instead of "CustomerID" ??? I'm just lucky for that)

2 : When i go to "customers" in otrs, I see my php created client, and in my database, all customer_user fields are filled for this customer BUT when I am in this customer ticket, in the right column "customer informations" it show "no informations" ... why ?

Thanks to help me
Locked