LiveHelperChat / osTicket

osTicket extension for Live Helper Chat
27 stars 21 forks source link

Send Custom Field to OSTicket #5

Closed clemilsonsantos closed 4 years ago

clemilsonsantos commented 8 years ago

When you create a new field in osTicket form it is necessary that this field is also filled in the chat, and sent to the osTicket.

Clemilson Santos

dbzfanatic commented 6 years ago

Just so everyone is aware:

Custom fields are included in "Additional chat data" when the ticket is created. By default this is all at the bottom of the created ticket but can be parsed with a bit of code in the bootstrap.php file for inclusion in the title if necessary. For example, let's say you've created a custom field called "Issue" with the identifier of "problem". You could parse that into the title of the ticket by adding

$sData = $chat->additional_data; $aProb = explode("value",$sData); $sData = preg_replace('/[^A-Za-z0-9\-\ ]/', '', $aProb[1]);

above $data = array( which should be line 116. To parse a different custom field change $aProb[1] and increment by 2 so it would be $aProb[3],$aProb[5],$aProb[7], etc. They will go through the custom fields values in order.

Them just add '{problem}' and $sData in their proper replacement locations in the array below '{email}' or '{nick}' and $chat->email or $chat->nick respectively.

Pietro-Aretino commented 6 years ago

Do you guys know if the USER has to be in osTicket as well? Right now I seem to only be able to get the extension to work if the user account is already in the osticket system. Otherwise it tells me it is unable to build a ticket