Jump to content

SendAdminEmail HOOK bug


leemason

Recommended Posts

im trying to send an email to all support department admins when a ticket is opened from the admin area.

 

everything works fine except the ticket id is never passed into the subject field, it shows in an email as:

 

[Ticket ID:] - the message name

 

ive followed the example api function to the letter, and tried a few variables to see if there where mistakes in the example page, but still nothing.

 

i know the ticketid is passed to the function as i tested it by printing out all the vars in the email and the ticket id is present, it just doesnt get passed to the subject line.]

 

here is my function:

 

function email_all_dept_users($vars){

$clientname = get_query_val('tblclients', 'firstname', array('id' => $vars['userid']));
$clientname .= ' '.get_query_val('tblclients', 'lastname', array('id' => $vars['userid']));

$deptname = get_query_val('tblticketdepartments', 'name', array('id' => $vars['deptid']));

$postfields["messagename"] = "Support Ticket Created";
$postfields["mergefields"]["client_name"] = $clientname;
$postfields["mergefields"]["client_id"] = $vars['userid'];
$postfields["mergefields"]["ticket_id"] = $vars['ticketid'];
       //$postfields["mergefields"]["ticketid"] = $vars['ticketid']; ive also tried this with no luck
$postfields["mergefields"]["ticket_department"] = $deptname;
$postfields["mergefields"]["ticket_subject"] = $vars['subject'];
$postfields["mergefields"]["ticket_priority"] = $vars['priority'];
$postfields["mergefields"]["ticket_message"] = $vars['message'].print_r($vars,true);//been doing this to check if ticket id is present
$postfields["type"] = "support";
$postfields["deptid"] = $vars['deptid'];

$results = localAPI("sendadminemail",$postfields);

}//function
add_hook("TicketOpenAdmin", 99, 'email_all_dept_users');

 

ive also tried different priorities from 1 all the way through to 99999

Link to comment
Share on other sites

that doesnt work becuase i "think" to use that you also have to specify a custom message as well which will probably mess up sites using a language other than english.

 

 

its strange because the subject of the message comes through as:

 

[Ticket ID: ] New Support Ticket Opened

 

so it is using the built in email template fine, just not using the ticket id, which is even more pussling as its written as per the documentation.

Link to comment
Share on other sites

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