Jump to content

Hook no longer working with 7.1


Kevin K

Recommended Posts

I have this hook that was working for years, but now that I upgraded to 7.1, it is no longer working. This hook emails all staff on support staff replies. I have tried changing several things, with no luck. The email is not being sent to all staff members like it should be.

 

I keep getting the error:

 

[result] => error [message] => Email Template not found ) ;

 

I was hoping someone could point out what might be wrong.

 

The hook:

 

if (!defined('WHMCS'))
die('This file cannot be accessed directly');


// Convert ticket id to tid
function id_to_tid($id) {
$table = "tbltickets";
$fields = "tid";
$where = array("id"=>$id);
$result = select_query($table,$fields,$where);
$data = mysql_fetch_array($result);
return $data['tid'];
}
function admin_reply_notification_hook_admin_reply($vars) {
$command = 'sendadminemail';
$adminuser = 'admin';
$values['messagename'] = 'Support Ticket Response';
$values['mergefields'] = array(
  'ticket_id' => $vars['ticketid'],
  'ticket_tid' => id_to_tid($vars['ticketid']),
  'admin' => $vars['admin'],
  'ticket_department' => $vars['deptname'],
  'ticket_subject' => $vars['subject'],
  'ticket_priority' => $vars['priority'],
  'ticket_message' => nl2br($vars['message']));
$values['type'] = 'support';
$values['deptid'] = $vars['deptid'];



$results = localAPI($command,$values,$adminuser); 
 logActivity($vars['admin'] . ' attempted to notify admins of reply to ticket #'.$vars['ticketid'].' ');  }

add_hook('TicketAdminReply',1,'admin_reply_notification_hook_admin_reply');

The Activity Error Log:

 

(I replaced some of the output to protect details. All info is correct though in the output)

 

"Staff Memeber Name" attempted to notify admins of reply to ticket #11111; result: Array ( [result] => error [message] => Email Template not found ) ; values: Array ( [messagename] => Support Ticket Response [mergefields] => Array ( [ticket_id] => 11111 [ticket_tid] => 1111111 [admin] => "Staff Memeber Name" [ticket_department] => Billing [ticket_subject] => test [ticket_priority] => Medium [ticket_message] => Hello Client, <br /> <br /> test123 ) [type] => support [deptid] => 3 ) 

 

 

 

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated