[SOLVED] Get Customer User name in AgentTicketPrint

Moderator: crythias

Locked
bitos
Znuny newbie
Posts: 34
Joined: 27 Nov 2013, 17:27
Znuny Version: 3.2.7

[SOLVED] Get Customer User name in AgentTicketPrint

Post by bitos »

Hello OTRS friends,

I'm trying to adapt the AgentTicketPrint module (\opt\otrs\Kernel\Modules\AgentTicketPrint.pm) to make it fit our needs a bit more.
(I'm talking about the Print option in the Ticket Zoom screen)

The original AgentTicketPrint module does show the customer info, but it takes up too much space.
What I'm trying to accomplish is to add the customer user info to the ticket info instead of using the customer info table.

The DTL template file (AgentTicketPrint.dtl) shows the customer info table using this code:

Code: Select all

<td colspan="4" class="contentkey">
            $Text{"Customer Info"}:
            $Data{"CustomerTable"}
</td>
I can get the CustomerUserID really easy in the DTL using:

Code: Select all

<td class="contentvalue">$QData{"CustomerUserID"}</td>
I'd like to be able to add the Customer User name and first name in a similar fashion as I can add the CustomerUserID.

I guess I'll have to query the name using CustomerUserDataGet, but i'm not very familiar with the framework and can't seem to get it to work.

I tried fooling around with the following code in AgentTicketPrint.pm (line 166), but no joy.

Code: Select all

    # customer info
    my %CustomerData;
    if ( $Ticket{CustomerUserID} ) {
        %CustomerData = $Self->{CustomerUserObject}->CustomerUserDataGet(
            User => $Ticket{CustomerUserID},
        );
    }
Can someone tell me how to get this done? Thanks!
I'm using OTRS 3.3.3
Last edited by bitos on 27 Mar 2015, 16:41, edited 1 time in total.
OTRS 3.3.3 on Cent0S 6.5 using MySQL.
bitos
Znuny newbie
Posts: 34
Joined: 27 Nov 2013, 17:27
Znuny Version: 3.2.7

Re: Get Customer User name in AgentTicketPrint

Post by bitos »

Ok, I managed to solve my own problem.

Add to sub Run:

Code: Select all

# BITOS - Get Customer User Full Name
my $Bitos_CustomerUser = $Self->{CustomerUserObject}->CustomerName(
	UserLogin => $Ticket{CustomerUserID},
);

Code: Select all

# show ticket
	$Output .= $Self->_HTMLMask(
	TicketID        => $Self->{TicketID},
	QueueID         => $QueueID,
	ArticleBox      => \@ArticleBox,
	Bitos_CustomerUser => $Bitos_CustomerUser,
	ResponsibleData => \%ResponsibleInfo,
	%Param,
	%UserInfo,
	%Ticket,
);

Add to sub _HTMLMask

Code: Select all

	# BITOS - Output Customer User Info
    my $CustomerUserInfo = '-';
        if ( $Param{Bitos_CustomerUser} ) {
			$CustomerUserInfo = $Param{Bitos_CustomerUser};
        }
        $Self->{LayoutObject}->Block(
            Name => 'CustomerUserInfo',
            Data => { CustomerUserInfoString => $CustomerUserInfo, },
        );
OTRS 3.3.3 on Cent0S 6.5 using MySQL.
Locked