I couldn't find a to do what I needed so I created this one today.
When a staff member post a "external" reply to ticket, it alerts all the staff members involved with the ticket.
There is a email template for the reply, and you can enable/disable and choose recipients.
Only the admin can change the settings, would be simple to let the departments control it also, but I don't need that feature so I stopped here.
#### Changes to the database
Run SQL:
ALTER TABLE `ost_config` ADD `reply_alert_active` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `message_alert_dept_manager` ,
ADD `reply_alert_laststaff` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `reply_alert_active` ,
ADD `reply_alert_assigned` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `reply_alert_laststaff` ,
ADD `reply_alert_dept_manager` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `reply_alert_assigned`
Also run:
ALTER TABLE `ost_email_template` ADD `reply_alert_subj` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `message_alert_body` ,
ADD `reply_alert_body` TEXT CHARACTER SET utf32 COLLATE utf32_general_ci NOT NULL AFTER `reply_alert_subj`
Optional Insert into reply_alert_subj :
New Staff Reply Alert
Optional Insert into reply_alert_body :
%{recipient},
%{staff} replied to %{ticket.name}'s ticket #%{ticket.number}.
----------------------------------
%{response}
----------------------------------
You are getting this alert because you have been involved in this ticket, a response from you may not be needed.
To view/respond to the ticket, please log-in to the support ticket system.
%{ticket.staff_link}
####Changes to include/staff/settings-alerts.inc.php
Add after:
> Department Manager (spammy)
Around line 60:
--- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
New Staff Reply Alert: Alert sent out when a new reply, from staff, is appended to an existing ticket
Status:
/>Enable
/>Disable
> Last Respondent
> Assigned Staff
> Department Manager (spammy)
--- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
####Changes to class.config.php
Add after:
function alertONNewMessage() {
return ($this->config);
}
function alertLastRespondentONNewMessage() {
return ($this->config);
}
function alertAssignedONNewMessage() {
return ($this->config);
}
function alertDeptManagerONNewReply() {
return ($this->config);
}
Around line 395:
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
function alertONNewReply() {
return ($this->config);
}
function alertLastRespondentONNewReply() {
return ($this->config);
}
function alertAssignedONNewReply() {
return ($this->config);
}
function alertDeptManagerONNewMessage() {
return ($this->config);
}
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
Add after:
if($vars
&& (!isset($vars)
&& !isset($vars)
&& !isset($vars))) {
$errors='Select recipient(s)';
}
Around line 815:
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
if($vars
&& (!isset($vars)
&& !isset($vars)
&& !isset($vars))) {
$errors='Select recipient(s)';
}
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
Add After:
$sql= 'UPDATE '.CONFIG_TABLE.' SET updated=NOW() '
.',ticket_alert_active='.db_input($vars)
.',ticket_alert_admin='.db_input(isset($vars)?1)
.',ticket_alert_dept_manager='.db_input(isset($vars)?1)
.',ticket_alert_dept_members='.db_input(isset($vars)?1)
.',message_alert_active='.db_input($vars)
.',message_alert_laststaff='.db_input(isset($vars)?1)
.',message_alert_assigned='.db_input(isset($vars)?1)
.',message_alert_dept_manager='.db_input(isset($vars)?1)
Around line 864:
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
.',reply_alert_active='.db_input($vars)
.',reply_alert_laststaff='.db_input(isset($vars)?1)
.',reply_alert_assigned='.db_input(isset($vars)?1)
.',reply_alert_dept_manager='.db_input(isset($vars)?1)
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
####Changes to class.ticket.php
Add after:
$this->onResponse(); //do house cleaning..
$this->reload();
Around 1628:
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---
// If alerts are not enabled then return a success.
if($alert || $cfg->alertONNewReply()) {
$dept = $this->getDept();
if(!($tpl = $dept->getTemplate()))
$tpl= $cfg->getDefaultTemplate();
if(!($email=$cfg->getAlertEmail()))
$email =$cfg->getDefaultEmail();
if($tpl && ($msg=$tpl->getNewReplyAlertMsgTemplate()) && $email) {
$msg = $this->replaceVars($msg,
array('response' => $vars, 'staff' => $thisstaff));
// Alert recipients
$recipients=array();
//Last respondent.
if($cfg->alertLastRespondentONNewReply())
$recipients=$this->getLastRespondent();
//Assigned staff if any...could be the last respondent
if($cfg->alertAssignedONNewReply() && $this->isAssigned() && $this->getStaffId())
$recipients=$this->getStaff();
//Dept manager
if($cfg->alertDeptManagerONNewReply() && $dept && $dept->getManagerId())
$recipients=$dept->getManager();
// TODO: Add send attachments optional to settings page
$attachments =($cfg->emailAttachments() && $attachments)?$this->getAttachments($respId,'R')();
$sentlist=array();
foreach( $recipients as $k=>$staff) {
if(!$staff || !is_object($staff) || !$staff->getEmail() || !$staff->isAvailable()) continue;
if(in_array($staff->getEmail(),$sentlist) || ($staffId && $staffId==$staff->getId())) continue;
$alert = str_replace('%{recipient}',$staff->getFirstName(), $msg);
$email->sendAlert($staff->getEmail(), $msg, $alert, $attachments);
$sentlist = $staff->getEmail();
}
}
}
// --- MOD: New Reply Alert, for 1.7RC5. by Tristan Novak, tbjnovak@gmail.com, 3-6-13 ---