template for text in CustomerTicketMessage

Moderator: crythias

Post Reply
GSBERLIN
Znuny newbie
Posts: 13
Joined: 05 May 2020, 12:26
Znuny Version: OTRS 6
Real Name: Gregor Schoenhard

template for text in CustomerTicketMessage

Post by GSBERLIN »

Hello,
i want to povide a template for the text in the form, the customer fills out while creating a new ticket in OTRS (customer.pl?Action=CustomerTicketMessage).
I didn´t find a way to do it.
Thanks for any hints.
Greetings from Berlin and a happy new year.
Gregor
skullz
Znuny superhero
Posts: 617
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Re: template for text in CustomerTicketMessage

Post by skullz »

if you know a bit around html, take a look at template example for agent ticket phone

1. https://github.com/znuny/Znuny/blob/9d2 ... one.tt#L53

2. https://github.com/znuny/Znuny/blob/9d2 ... ne.tt#L349

3. Then apply it to CustomerticketMessage.tt

Example

Code: Select all

# example template for customizations, see hidden form at the end of the file
<label>[% Translate("Templates") | html %]:</label>
<div class="Field">
<button type="button" onclick="$('#Template1').submit()" value="[% Translate("Example Template 1") | html %]">[% Translate("Example Template 1") | html %]</button>
<button type="button" onclick="$('#Template2').submit()" value="[% Translate("Example Template 2") | html %]">[% Translate("Example Template 2") | html %]</button>
</div>
<div class="Clear"></div>

Code: Select all

# example template form for customizations
<form action="[% Env("CGIHandle") %]" method="post" enctype="multipart/form-data" id="Template1">
    <input type="hidden" name="Action" value="[% Env("Action") %]"/>
    <input type="hidden" name="Subaction" value="StoreNew"/>
    <input type="hidden" name="FormID" value="[% Data.FormID | html %]"/>
    <input type="hidden" name="Expand" value="1"/>
    <input type="hidden" name="TypeID" value="1"/>
    <input type="hidden" name="Dest" value="5||IT Department"/>
    <input type="hidden" name="Subject" value="Example Subject 1"/>
    <input type="hidden" name="Body" value="Name 1:<br/>
Product 1:<br/>
Comment 1:"/>
</form>

<form action="[% Env("CGIHandle") %]" method="post" enctype="multipart/form-data" id="Template2">
    <input type="hidden" name="Action" value="[% Env("Action") %]"/>
    <input type="hidden" name="Subaction" value="StoreNew"/>
    <input type="hidden" name="FormID" value="[% Data.FormID | html %]"/>
    <input type="hidden" name="Expand" value="1"/>
    <input type="hidden" name="TypeID" value="2"/>
    <input type="hidden" name="Dest" value="2||Raw"/>
    <input type="hidden" name="Subject" value="Example Subject 2"/>
    <input type="hidden" name="Body" value="Name 2:<br/>
Product 2:<br/>
Comment 2:"/>
</form>
good luck
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: template for text in CustomerTicketMessage

Post by reneeb »

If you know some JavaScript, you could create a javascript file and a config file: https://os.perl-services.de/perl-academ ... uickticket

That doesn't require to change any framework files.

Or you could use https://feature-addons.de/znuny/Ticket/TicketTemplates
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
gschulz
Znuny newbie
Posts: 8
Joined: 13 Jun 2016, 15:51
Znuny Version: 6.0.35
Real Name: Gabi Schulz

Re: template for text in CustomerTicketMessage

Post by gschulz »

The javascript works without any problems with Ticketphone.
Is it possible to use this javascript in the customer ticket message as well.
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: template for text in CustomerTicketMessage

Post by reneeb »

Code: Select all

    $('#NewPhoneTicket>fieldset').prepend(
        '<div class="Field"><button type="button" id="quickticket">QuickTicket</button></div><div class="Clear"></div>'
    );
This defines, that the "QuickTicket" button is shown in the new phone ticket dialog. You have to find the ID of the customer ticket message dialog and update the javascript.
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
gschulz
Znuny newbie
Posts: 8
Joined: 13 Jun 2016, 15:51
Znuny Version: 6.0.35
Real Name: Gabi Schulz

Re: template for text in CustomerTicketMessage

Post by gschulz »

The ID of the customer ticket message dialog is NewCustomerTicket.

I made the following changes .

Javascript:

Code: Select all

$('#NewCustomerTicket>fieldset').prepend(
    $('#Attachment>fieldset').prepend(
        '<div class="Field"><button type="button" id="quickticket1">Test</button></div><div class="Clear"></div>'

XML:

Code: Select all

     <Setting Name="Loader::Module::CustomerTicketZoom###004-QuickTicket" Required="0" Valid="1">
         <Description Translatable="1">Loader module registration for the Customer interface.</Description>
         <Navigation>Frontend::Customer::ModuleRegistration::Loader</Navigation>
         <value>
             <hash>
                 <Item Key="JavaScript">
                     <array>
                         <Item>Custom.QuickTicket.js</Item>
                     </array>
                 </item>
             </hash>
         </Value>
     </Setting> 
But this doesn't work either.
gschulz
Znuny newbie
Posts: 8
Joined: 13 Jun 2016, 15:51
Znuny Version: 6.0.35
Real Name: Gabi Schulz

Re: template for text in CustomerTicketMessage

Post by gschulz »

I fixed the problem.
The error was in the XML.

correct is:

Code: Select all

    <Setting Name="Loader::Module::CustomerTicketMessage###004-QuickTicket" Required="0" Valid="1">
        <Description Translatable="1">Loader module registration for the Customer interface.</Description>
        <Navigation>Frontend::Customer::ModuleRegistration::Loader</Navigation>
        <Value>
            <Hash>
                <Item Key="JavaScript">
                    <Array>
                        <Item>Custom.QuickTicket.js</Item>
                    </Array>
                </Item>
            </Hash>
        </Value>
    </Setting>
Now it works as desired.
Post Reply