Adjust that function ...
Well, it looks like your replaceTemplateVars has been changed before. That's why it looks different with mine. You have to adjust the position for each $search array element, should be match with the position for each $replace array element.
Please, use this code below. It should be working now after you use this function.
//Replace base variables.
function replaceTemplateVars($text){
global $cfg;
global $thisuser;
$dept = $this->getDept();
$staff= $this->getStaff();
$search = array('/%id/','/%ticket/','/%email/','/%name/','/%subject/','/%topic/','/%phone/','/%status/','/%priority/',
'/%dept/','/%assigned_staff/','/%createdate/','/%duedate/','/%closedate/','/%url/','/%msg/','/%internal/','/%assignee/','/%assigner/');
$replace = array($this->getId(),
$this->getExtId(),
$this->getEmail(),
$this->getName(),
$this->getSubject(),
$this->getHelpTopic(),
$this->getPhoneNumber(),
$this->getStatus(),
$this->getPriority(),
($dept?$dept->getName():''),
($staff?$staff->getName():''),
Format:($this->getCreateDate()),
Format:($this->getDueDate()),
Format:($this->getCloseDate()),
$cfg->getBaseUrl(),
$this->getMsgText(),
$this->getInternalNotes(),
($staff?$staff->getName():''),
$thisuser->getUsername()
);
return preg_replace($search,$replace,$text);
}
Sincerely,
Masino Sinaga