Include Article dynamic fields in text field

Moderator: crythias

Locked
mavrie
Znuny newbie
Posts: 43
Joined: 02 Sep 2014, 15:04
Znuny Version: 4.0.7
Real Name: Mattias
Company: BusSaP
Location: Belgium

Include Article dynamic fields in text field

Post by mavrie »

Hello everyone,

I defined two article Data/Time dynamic fields (Start & Stop) to determine the amount of time worked on this article in the ticket.

I got them to show up in the AgentTicketZoom page and that is great.
What I want to achieve in short, is that the amount of time worked on this article, is included in text part of that article.
That way our customer receives the article (with information on what we did, and how long it took).

Can anyone point me in the right direction once again?

Thanks in advance :)
Otrs 4.0.7 on CentOS 6.5
MySQL Database
mavrie
Znuny newbie
Posts: 43
Joined: 02 Sep 2014, 15:04
Znuny Version: 4.0.7
Real Name: Mattias
Company: BusSaP
Location: Belgium

Re: Include Article dynamic fields in text field

Post by mavrie »

Anyone have any idea?

Can't find information about this online.

Much appreciated.

Matt
Otrs 4.0.7 on CentOS 6.5
MySQL Database
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: Include Article dynamic fields in text field

Post by reneeb »

I would create a small javascript function that is called when the "submit" button is clicked. That function calculates the time worked on the ticket and add that to the article.

The javascript function should be in its own js-file that should be added in the sysconfig option of the frontendmodule where you want to add it.

The code could be something like

Code: Select all

$(document).ready( function() {
    $('#submitRichText').bind('click', function() {
        var time_worked = ...; // here you need to calculate the time worked
        var editor_text   = CKEDITOR.instances.RichText.getData();
        var my_text        = editor_text + "<br /><br />Worked time: " + time_worked;
        CKEDITOR.instances.RichText.setData( my_text );
   });
});
(untested)
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
Locked