1

在 OTRS(版本 3.1、3.2 或 3.3)中是否可以在客户概览 (CustomerTicketOverview.dtl) 或详细信息 (CustomerTicketZoom.dtl) 页面中显示工单的初始创建者?例如,如果我作为代理创建工单,我想显示代理名称,否则如果客户创建了该工单,那么我想显示客户姓名。

我试过这个:

$Text{"$QData{"FromRealname","60"}"}

这似乎总是打印最后一个响应票的用户的名字。如果工单是新工单,如果是客户创建的工单或电话工单,则它包含客户的姓名;否则,如果是电子邮件工单,它似乎包含分配给队列的电子邮件地址的名称。

$Text{"$Data{"CreatedBy"}"}

这似乎包含创建票证的人的 ID。有什么办法可以做我想做的事吗?

4

1 回答 1

1

对的,这是可能的。但是您必须进行查找以将 UserID 转换为“可读”名称。

首先,将 Kernel/Modules/CustomerTicketZoom.pm 复制到 Custom/Kernel/Modules/CustomerTicketZoom.pm 然后像这样修改 _mask 方法(在 L#:1000 附近):

    # ticket owner
if ( $Self->{Config}->{AttributesView}->{Owner} ) {
    my $OwnerName = $Self->{AgentUserObject}->UserName(
        UserID => $Param{OwnerID},
    );
    $Self->{LayoutObject}->Block(
        Name => 'Owner',
        Data => { OwnerName => $OwnerName },
    );
}
####### this is the new part #######
# ticket creator
if ( $Param{CreateBy} != 1 ) {

    #1 is the default account if a ticket is created by a customer
    my $CreatorName = $Self->{AgentUserObject}->UserName(
        UserID => $Param{CreateBy},
    );
    $Self->{LayoutObject}->Block(
        Name => 'Creator',
        Data => { CreatorName => $CreatorName },
    );

}
####### this is the end of the new part #######    
# ticket responsible
if (
    $Self->{ConfigObject}->Get('Ticket::Responsible')
    &&
    $Self->{Config}->{AttributesView}->{Responsible}
    )
{
    my $ResponsibleName = $Self->{AgentUserObject}->UserName(
        UserID => $Param{ResponsibleID},
    );
    $Self->{LayoutObject}->Block(
        Name => 'Responsible',
        Data => { ResponsibleName => $ResponsibleName },
    );
}

# check if ticket is normal or process ticket

我使用的是 OTRS 3.3.8+ITSM,因此您的行号可能会有所不同。新插入的块检查创建者是否为 != UserID 1,如果创建者不是代理,则 OTRS 用于创建票证的本地管理员帐户。如果它的 != 1 OTRS 执行查找并将真实姓名保存在 var 中。在此之后,创建者 dtl:block 被渲染。

第二部分:修改您的模板文件:将原始文件从 Kernel/Output/HTML/Standard/CustomerTicketZoom.dtl 复制到:Custom/Kernel/OUTPUT/HTML/Standard/CustomerTicketZoom.dtl

并插入一个新块(大约 L#:190 - 在所有者块之后):

<!-- dtl:block:Creator -->
                    <li><span class="Key">$Text{"Creator"}:</span> $QData{"CreatorName"}</li>
<!-- dtl:block:Creator -->

应用更改后,应正确显示创建者。

于 2014-09-21T16:31:50.673 回答