email staff owner after ticket is replied to
Posted: Wed Jun 06, 2012 7:31 pm
Script URL: ambitechstrous-help.com
Version of script: 2.3
Hosting company: hostgator
URL of phpinfo.php: http://ambitechstrous-help.com/phpjunkyardfiles/
URL of session_test.php: http://ambitechstrous-help.com/phpjunkyardfiles/
What terms did you try when SEARCHING for a solution: staff email; owner email
Write your message below:
Hi Klemen, thanks again for this great software. I use it daily with my team.
My goal is that a reply to a ticket would generate an automatic email and send it to the one who is the ticket "owner" (the one to whom the ticket is assigned). This way, the staff does not have to keep checking back with the site, but would receive an email letting them know when they need to respond.
The feature I'm looking for is similar to what happens when I (as admin) submit a ticket:
1. one automatic email goes to the email for that ticket
2. another one goes to the staff to whom the ticket is assigned.
I thought perhaps copying part of admin_submit_ticket.php and adding it to admin_reply_ticket.php would do the trick. But after a couple hours of banging my head against the wall, I'm giving up on my abilities.
Can you help? Is there something easy that I'm missing?
In case you want to see my attempt at tweaking the code, here's what I added to admin_reply_ticket.php:
(I added it around line 221)
if ($owner && $owner != intval($_SESSION['id']))
{
/* If we don't have info from auto-assign get it from database */
if ( ! isset($autoassign_owner['email']) )
{
/* I updated the last value to 'notify_reply_my' */
$sql = "SELECT `email`,`isadmin`,`categories`,`notify_reply_my` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`=".hesk_dbEscape($ticket['owner']);
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res))
{
$autoassign_owner = hesk_dbFetchAssoc($res);
}
}
/* Notify the staff? */
/* I updated the last value to 'notify_reply_my' */
if ($autoassign_owner['notify_reply_my'])
{
/* Format e-mail message */
/* I updated the first value to 'new_reply_by_staff' */
$msg = hesk_getEmailMessage('new_reply_by_staff',$ticket,1);
/* Send e-mail to staff */
hesk_mail($autoassign_owner['email'],$ticket['subject'].' ('.$ticket['name'].')',$msg);
}
}
/* Ticket unassigned, notify everyone that selected to be notified about unassigned tickets */
elseif ( ! $owner)
{
$admins=array();
$sql = "SELECT `email`,`isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`!=".hesk_dbEscape($_SESSION['id'])." AND `notify_new_unassigned`='1'";
$result = hesk_dbQuery($sql);
while ($myuser=hesk_dbFetchAssoc($result))
{
/* Is this an administrator? */
if ($myuser['isadmin'])
{
$admins[]=$myuser['email'];
continue;
}
/* Not admin, is he allowed this category? */
$myuser['categories']=explode(',',$myuser['categories']);
if (in_array($tmpvar['category'],$myuser['categories']))
{
$admins[]=$myuser['email'];
continue;
}
}
if (count($admins)>0)
{
/* Format e-mail message for staff */
$msg = hesk_getEmailMessage('new_reply_by_staff',$ticket,1);
/* Send e-mail to staff */
$email=implode(',',$admins);
hesk_mail($email,$subject,$msg);
}
}
Much thanks
Jon
Version of script: 2.3
Hosting company: hostgator
URL of phpinfo.php: http://ambitechstrous-help.com/phpjunkyardfiles/
URL of session_test.php: http://ambitechstrous-help.com/phpjunkyardfiles/
What terms did you try when SEARCHING for a solution: staff email; owner email
Write your message below:
Hi Klemen, thanks again for this great software. I use it daily with my team.
My goal is that a reply to a ticket would generate an automatic email and send it to the one who is the ticket "owner" (the one to whom the ticket is assigned). This way, the staff does not have to keep checking back with the site, but would receive an email letting them know when they need to respond.
The feature I'm looking for is similar to what happens when I (as admin) submit a ticket:
1. one automatic email goes to the email for that ticket
2. another one goes to the staff to whom the ticket is assigned.
I thought perhaps copying part of admin_submit_ticket.php and adding it to admin_reply_ticket.php would do the trick. But after a couple hours of banging my head against the wall, I'm giving up on my abilities.
Can you help? Is there something easy that I'm missing?
In case you want to see my attempt at tweaking the code, here's what I added to admin_reply_ticket.php:
(I added it around line 221)
if ($owner && $owner != intval($_SESSION['id']))
{
/* If we don't have info from auto-assign get it from database */
if ( ! isset($autoassign_owner['email']) )
{
/* I updated the last value to 'notify_reply_my' */
$sql = "SELECT `email`,`isadmin`,`categories`,`notify_reply_my` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`=".hesk_dbEscape($ticket['owner']);
$res = hesk_dbQuery($sql);
if (hesk_dbNumRows($res))
{
$autoassign_owner = hesk_dbFetchAssoc($res);
}
}
/* Notify the staff? */
/* I updated the last value to 'notify_reply_my' */
if ($autoassign_owner['notify_reply_my'])
{
/* Format e-mail message */
/* I updated the first value to 'new_reply_by_staff' */
$msg = hesk_getEmailMessage('new_reply_by_staff',$ticket,1);
/* Send e-mail to staff */
hesk_mail($autoassign_owner['email'],$ticket['subject'].' ('.$ticket['name'].')',$msg);
}
}
/* Ticket unassigned, notify everyone that selected to be notified about unassigned tickets */
elseif ( ! $owner)
{
$admins=array();
$sql = "SELECT `email`,`isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`!=".hesk_dbEscape($_SESSION['id'])." AND `notify_new_unassigned`='1'";
$result = hesk_dbQuery($sql);
while ($myuser=hesk_dbFetchAssoc($result))
{
/* Is this an administrator? */
if ($myuser['isadmin'])
{
$admins[]=$myuser['email'];
continue;
}
/* Not admin, is he allowed this category? */
$myuser['categories']=explode(',',$myuser['categories']);
if (in_array($tmpvar['category'],$myuser['categories']))
{
$admins[]=$myuser['email'];
continue;
}
}
if (count($admins)>0)
{
/* Format e-mail message for staff */
$msg = hesk_getEmailMessage('new_reply_by_staff',$ticket,1);
/* Send e-mail to staff */
$email=implode(',',$admins);
hesk_mail($email,$subject,$msg);
}
}
Much thanks
Jon