#66 Business Logic portion of emails to admins are done.
Still need to add the option to the edit user / profile page
This commit is contained in:
parent
219b722917
commit
3d4c0a99b7
@ -241,51 +241,47 @@ if (isset($_POST['notemsg']) && hesk_token_check('POST'))
|
|||||||
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."notes` (`ticket`,`who`,`dt`,`message`) VALUES ('".intval($ticket['id'])."','".intval($_SESSION['id'])."',NOW(),'".hesk_dbEscape($msg)."')");
|
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."notes` (`ticket`,`who`,`dt`,`message`) VALUES ('".intval($ticket['id'])."','".intval($_SESSION['id'])."',NOW(),'".hesk_dbEscape($msg)."')");
|
||||||
|
|
||||||
/* Notify assigned staff that a note has been added if needed */
|
/* Notify assigned staff that a note has been added if needed */
|
||||||
if ($ticket['owner'] && $ticket['owner'] != $_SESSION['id'])
|
$users = hesk_dbQuery("SELECT `email`, `notify_note` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE (`id`='".intval($ticket['owner'])."' OR (`isadmin` = '1' AND `notify_note_unassigned` = '1')) AND `id` <> '".intval($_SESSION['id'])."'");
|
||||||
|
|
||||||
|
if (hesk_dbNumRows($users) > 0)
|
||||||
{
|
{
|
||||||
$res = hesk_dbQuery("SELECT `email`, `notify_note` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`='".intval($ticket['owner'])."' LIMIT 1");
|
// 1. Generate the array with ticket info that can be used in emails
|
||||||
|
$info = array(
|
||||||
|
'email' => $ticket['email'],
|
||||||
|
'category' => $ticket['category'],
|
||||||
|
'priority' => $ticket['priority'],
|
||||||
|
'owner' => $ticket['owner'],
|
||||||
|
'trackid' => $ticket['trackid'],
|
||||||
|
'status' => $ticket['status'],
|
||||||
|
'name' => $_SESSION['name'],
|
||||||
|
'lastreplier' => $ticket['lastreplier'],
|
||||||
|
'subject' => $ticket['subject'],
|
||||||
|
'message' => stripslashes($msg),
|
||||||
|
'dt' => hesk_date($ticket['dt'], true),
|
||||||
|
'lastchange' => hesk_date($ticket['lastchange'], true),
|
||||||
|
);
|
||||||
|
|
||||||
if (hesk_dbNumRows($res) == 1)
|
// 2. Add custom fields to the array
|
||||||
{
|
foreach ($hesk_settings['custom_fields'] as $k => $v)
|
||||||
$owner = hesk_dbFetchAssoc($res);
|
{
|
||||||
|
$info[$k] = $v['use'] ? $ticket[$k] : '';
|
||||||
|
}
|
||||||
|
|
||||||
// 1. Generate the array with ticket info that can be used in emails
|
// 3. Make sure all values are properly formatted for email
|
||||||
$info = array(
|
$ticket = hesk_ticketToPlain($info, 1, 0);
|
||||||
'email' => $ticket['email'],
|
|
||||||
'category' => $ticket['category'],
|
|
||||||
'priority' => $ticket['priority'],
|
|
||||||
'owner' => $ticket['owner'],
|
|
||||||
'trackid' => $ticket['trackid'],
|
|
||||||
'status' => $ticket['status'],
|
|
||||||
'name' => $_SESSION['name'],
|
|
||||||
'lastreplier' => $ticket['lastreplier'],
|
|
||||||
'subject' => $ticket['subject'],
|
|
||||||
'message' => stripslashes($msg),
|
|
||||||
'dt' => hesk_date($ticket['dt'], true),
|
|
||||||
'lastchange' => hesk_date($ticket['lastchange'], true),
|
|
||||||
);
|
|
||||||
|
|
||||||
// 2. Add custom fields to the array
|
/* Get email functions */
|
||||||
foreach ($hesk_settings['custom_fields'] as $k => $v)
|
require(HESK_PATH . 'inc/email_functions.inc.php');
|
||||||
{
|
|
||||||
$info[$k] = $v['use'] ? $ticket[$k] : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Make sure all values are properly formatted for email
|
/* Format email subject and message for staff */
|
||||||
$ticket = hesk_ticketToPlain($info, 1, 0);
|
$subject = hesk_getEmailSubject('new_note',$ticket);
|
||||||
|
$message = hesk_getEmailMessage('new_note',$ticket,1);
|
||||||
|
|
||||||
/* Get email functions */
|
/* Send email to staff */
|
||||||
require(HESK_PATH . 'inc/email_functions.inc.php');
|
while ($user = hesk_dbFetchAssoc($users)) {
|
||||||
|
hesk_mail($user['email'], $subject, $message);
|
||||||
/* Format email subject and message for staff */
|
}
|
||||||
$subject = hesk_getEmailSubject('new_note',$ticket);
|
|
||||||
$message = hesk_getEmailMessage('new_note',$ticket,1);
|
|
||||||
|
|
||||||
/* Send email to staff */
|
|
||||||
hesk_mail($owner['email'], $subject, $message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
header('Location: admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999));
|
header('Location: admin_ticket.php?track='.$trackingID.'&Refresh='.mt_rand(10000,99999));
|
||||||
exit();
|
exit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user