any help on assigning user on ticket created from e-mail?

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

any help on assigning user on ticket created from e-mail?

Post by dr_patso »

Need just some direction on modifying logic of pipe_functions.inc.php

Code: Select all

	// Auto assign tickets if aplicable
	$tmpvar['owner']   = 0;
If I modify that 0 to a specific user ID, it works and tickets are assigned to that user. I need it to work like this

Code: Select all

	// Auto assign tickets if aplicable
	$tmpvar['owner']   = If FROM e-mail address matches hesk_users.e-mail set corresponding to their user id;
I couldn't think of any similar query that exists in hesk I could steal this from..

Basically I've already modified the customer name and e-mail on ticket to be set as the TO: from the e-mail sent to hesk. Now I want the ticket to get assigned to the users e-mail it came FROM:. Any help much appreciated.. I will be digging on this for the next few weeks.

How I want my e-mail piping to work is (User sends response to customer and BCCs hesk pop account. This way when the staff sends a response, a ticket is generated for that end user and assigned to the particular staff member in hesk.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: any help on assigning user on ticket created from e-mail

Post by Klemen »

Please note that teaching how to perform SQL queries is beyond the scope of this forum, there are hundreds of online PHP/MySQL tutorials.

That said, something like this should get you started:

Code: Select all

$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `email` LIKE '".hesk_dbEscape(hesk_dbLike($tmpvar['email']))."' LIMIT 1");
if (hesk_dbNumRows($res) == 1)
{
	$row = hesk_dbFetchAssoc($res);
	$tmpvar['owner'] = $row['id'];
}
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: any help on assigning user on ticket created from e-mail

Post by dr_patso »

hehe, that worked. You freakin rock Klemen. Since i modified $tmpvar['email'] to use the To: address, I just created a new $tmpvar['from_email'] and used that in the query.

I understand SQL queries a bit and might have figured it out eventually but i am not familiar with all the hesk query functions like you included there. If you feel like you can chime in, what is the best way to get familiar with the RAW code for those functions like hesk_dbquery hes_dblike, hesk_dbnumrows etc.? when i do a find in files search it's hard to locate the source when so many files are using the function.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: any help on assigning user on ticket created from e-mail

Post by Klemen »

Most functions used are in files located inside the "inc" folder. The database ones for example are in the "database.inc.php" and "database-mysqli.inc.php" files (one is loaded for MySQL and one for MySQLi extension).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply