Page 1 of 1

Closing a ticket via email from admin

Posted: Thu Oct 09, 2014 7:21 am
by Matt Tews
Script URL: ?
Version of script: Version: 2.5.5 from 5th August 2014
Hosting company: Godaddy
URL of phpinfo.php: ?
URL of session_test.php: ?
What terms did you try when SEARCHING for a solution: +email +close

Write your message below:
I would like to be able - as an admin - to reply to a ticket email with a code or keyword (*CLOSED*) in the subject line and have the email parser read that subject line and close the ticket if the email is sent from the admin for the ticket. Where might the code be that could be modified to handle this?

It would save time by relieving the admin from having to log into the interface to close a ticket. Thoughts?

Re: Closing a ticket via email from admin

Posted: Thu Oct 09, 2014 8:32 pm
by Matt Tews
I am getting closer on my own. So far, minor edits to pipe_functions.inc.php are showing some promise. This is where I started:

/////////////////////////////////////////////////
// Now determine if this contains a CLOSED response
$tmpvar['closed'] = '';

if ( preg_match('/CLOSED/', str_replace(' ', '', $tmpvar['subject']), $matches_closed) )
{
// We found "CLOSED" in the subject
$tmpvar['closed'] = $matches_closed[0];
}
/////////////////////////////////////////////////
...later in page
/////////////////////////////////////////////////
// Mark ticket as resolved if subject is CLOSED from admin email account
if (($tmpvar['closed'] == 'CLOSED') && ($tmpvar['email'] == 'xxxx@support-company.com')) {
$ticket['status'] = 3;
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `lastchange`=NOW(),`status`='{$ticket['status']}',`lastreplier`='0' WHERE `id`='".intval($ticket['id'])."' LIMIT 1");
}
/////////////////////////////////////////////////

Re: Closing a ticket via email from admin

Posted: Fri Oct 10, 2014 12:13 pm
by Klemen
Is this working for you or are you having any specific problems?

Re: Closing a ticket via email from admin

Posted: Fri Oct 10, 2014 4:44 pm
by Matt Tews
The code above IS working for me...thank you for asking. I posted it here in the event someone else wants to use it.

I am working though your email notification mods in your patch file from this thread:

viewtopic.php?f=13&t=5017

Again...so far, so good. My goal is to be able to open/reply/close tickets all by direct e-mails and use HESK as the go-between tracking system. Your code has been very easy to work with so far.

Thank you much!

-Matt

Re: Closing a ticket via email from admin

Posted: Fri Oct 10, 2014 7:37 pm
by Klemen
Thanks for sharing your code!

But if you plan on doing everything over email, isn't HESK just an unnecessary extra step in between?

A note on security though - sender email is extremely easy to spoof, so be careful when implementing email functionality/interactions.

Re: Closing a ticket via email from admin

Posted: Fri Oct 10, 2014 10:52 pm
by Matt Tews
More good questions...

I am supporting a couple small projects (10-12 contractors each). What we are missing is a way to summarize all of the various support tasks and easily determine if there are any outstanding requests. It would also be helpful for the CIO/CFO types to be able to review the threads of a given task without needing to be on the email distro.

We also want the contractors who generate a dozen monthly requests to be able to log in and review the status of all their projects in a glance. This my only be needed a couple times a year, but still - when it's needed, it's there.

We don't want to require someone to log into a site to update tickets, but rather enable the current email stream to be documented. For this, I think your HESK platform can be modified to be made ideal.