Time Units column in customer interface

Moderator: crythias

Locked
napster
Znuny newbie
Posts: 9
Joined: 13 Jan 2014, 17:34
Znuny Version: 3.3.3
Real Name: Kevin Loos
Company: Axentys

Time Units column in customer interface

Post by napster »

Hi,

I manage to add a new column in the customer web interface by adding code to the customerTicketOverview.dtl

Code: Select all

<th class="WorkTime $LQData{"WorkTime Sort"}">
		<a href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=$Env{"Subaction"};SortBy=WorkTime ;OrderBy=$LQData{"OrderBy"} Filter=$LQData{"Filter"}">
		$Text{"WorkTime "}
		</a>
</th>

Code: Select all

<td class="Value">$Data{"TicketTimeUnits2"}</td>
Now, I'd like to add the time unit (work time) value into this column.

I can't find where I have to write my SQL request to get the time unit value

Thank you !

PS : Sorry for my bad English
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Time Units column in customer interface

Post by crythias »

napster wrote:Now, I'd like to add the time unit (work time) value into this column.

I can't find where I have to write my SQL request to get the time unit value
This is your custom field. If you had used a DynamicField to hold your value, the answer would be different than however you made/provisioned your field.

What's your OTRS version? How would someone answer your question as you've provided? How would someone replicate your experience? Read my "Need Help?" link in my signature.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
napster
Znuny newbie
Posts: 9
Joined: 13 Jan 2014, 17:34
Znuny Version: 3.3.3
Real Name: Kevin Loos
Company: Axentys

Re: Time Units column in customer interface

Post by napster »

Hi,

Thanks for your answer

I didn't use DynamicField because this field already exist in OTRS so I don't understand why I can't display it in the customer interface.

For example you can see it in a AgentTicketZoom on the right banner "ticket information" under Accounted time

My OTRS version is 3.3.3 on Windows Server 2012

I don't know how to replicate my experience because It's not an issue it's something I'm trying to do :)

Thanks
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Time Units column in customer interface

Post by reneeb »

The TicketObject has a method for that: TicketAccountedTimeGet (see http://otrs.perl-services.de/docs/otrs/ ... icket.html)
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
napster
Znuny newbie
Posts: 9
Joined: 13 Jan 2014, 17:34
Znuny Version: 3.3.3
Real Name: Kevin Loos
Company: Axentys

Re: Time Units column in customer interface

Post by napster »

Thanks,

I tried to do it that way

CustomerTicketOverview.pm :

Code: Select all

my $ConfigObject = Kernel::Config->new();
	my $EncodeObject = Kernel::System::Encode->new(
		ConfigObject => $ConfigObject,
	);
	my $LogObject = Kernel::System::Log->new(
		ConfigObject => $ConfigObject,
		EncodeObject => $EncodeObject,
	);
	my $TimeObject = Kernel::System::Time->new(
		ConfigObject => $ConfigObject,
		LogObject    => $LogObject,
	);
	my $MainObject = Kernel::System::Main->new(
		ConfigObject => $ConfigObject,
		EncodeObject => $EncodeObject,
		LogObject    => $LogObject,
	);
	my $DBObject = Kernel::System::DB->new(
		ConfigObject => $ConfigObject,
		EncodeObject => $EncodeObject,
		LogObject    => $LogObject,
		MainObject   => $MainObject,
	);
	my $TicketObject = Kernel::System::Ticket->new(
		ConfigObject       => $ConfigObject,
		LogObject          => $LogObject,
		DBObject           => $DBObject,
		MainObject         => $MainObject,
		TimeObject         => $TimeObject,
		EncodeObject       => $EncodeObject,
		GroupObject        => $GroupObject,        # if given
		CustomerUserObject => $CustomerUserObject, # if given
		QueueObject        => $QueueObject,        # if given
	);
	
	my $AccountedTime = $TicketObject->TicketAccountedTimeGet(TicketID => 52);
	$Self->{supertime}        = $AccountedTime;
But my value isn't display in the customer interface

My CustomerTicketOverview.dtl

Code: Select all

<td class="Value">$Data{"supertime"}</td>
I probably doing it wrong but coding is not my speciality and I just need this function :)

Thanks
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Time Units column in customer interface

Post by reneeb »

No need to create all the objects. There is a TicketObject available in CustomerTicketOverview.pm

You should find something like

Code: Select all

    # get ticket info
    my %Ticket = $Self->{TicketObject}->TicketGet(
        TicketID => $TicketID,
        DynamicFields => 0,
    );
in the code.

Just put a

Code: Select all

$Ticket{supertime} = $Self->{TicketObject}->TicketAccountedTimeGet( TicketID => $TicketID );
right after it.
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
napster
Znuny newbie
Posts: 9
Joined: 13 Jan 2014, 17:34
Znuny Version: 3.3.3
Real Name: Kevin Loos
Company: Axentys

Re: Time Units column in customer interface

Post by napster »

Thanks it works !

:D
Locked