osTicket添加变量


osTicket add variables

我已经开箱即用osTicket好几年了,它的效果非常好。我现在正在为我支持的一些医疗诊所使用这个系统,我添加了一个额外的字段,要求用户输入他们所在诊所的名称。

这也起到了作用,但我不知道如何将诊所名称包含在自动电子邮件中,该电子邮件告诉我的员工有一张新机票。我想我需要添加一个新的基础变量,但不知道怎么做?有什么想法吗?

include/class.ticket.php中,第422行

他们都在这个功能中。相应地添加到$search&$replace

function replaceTemplateVars($text){
    global $cfg;
    $dept = $this->getDept();
    $staff= $this->getStaff();
    $search = array('/%id/','/%ticket/','/%email/','/%name/','/%subject/','/%topic/','/%phone/','/%status/','/%priority/',
                    '/%dept/','/%assigned_staff/','/%createdate/','/%duedate/','/%closedate/','/%url/');
    $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::db_daydatetime($this->getCreateDate()),
                     Format::db_daydatetime($this->getDueDate()),
                     Format::db_daydatetime($this->getCloseDate()),
                     $cfg->getBaseUrl());
    return preg_replace($search,$replace,$text);
}

我确实发现class.msgtpl.php(''include''class.msgtplphp)的第32行说明了这一点:

$sql='SELECT * FROM '.EMAIL_TEMPLATE_TABLE.' WHERE tpl_id='.db_input($id);

模板中是否有允许您使用自定义变量的内容?如果没有,你可以自己写,因为这可能只是一个简单的preg_replace。