【问题标题】:OTRS Initial creator of a ticketOTRS 票证的初始创建者
【发布时间】:2014-09-15 17:31:26
【问题描述】:

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

我试过了:

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

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

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

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

【问题讨论】:

    标签: themes otrs


    【解决方案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 复制到: 自定义/内核/输出/HTML/标准/CustomerTicketZoom.dtl

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-17
      • 1970-01-01
      • 2020-06-02
      • 2013-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多