reset of subject and body on attachment load

Moderator: crythias

Locked
Giulio Soleni
Znuny wizard
Posts: 392
Joined: 30 Dec 2010, 14:35
Znuny Version: 6.0.x and 5.0.x
Real Name: Giulio Soleni
Company: IKS srl

reset of subject and body on attachment load

Post by Giulio Soleni »

Hi,
I am using the hints from crythias howto "How To show freetext for specific Queues for Customers" http://forums.otrs.org/viewtopic.php?f=60&t=8032#p31758 to present some preformatted text for some queues only, in the Customer Interface (CustomerTicketMessage.dtl).
It works pretty good and I find it really useful.
There's a issue, however.

If a customer would like to open a ticket and select a queue which has this preformatted text... he fill in and customize the text according to his specific needs and _then_ he decide to load an attachment file to this ticket, the text of the subject and of the body gets reset to the preformatted text... that is, all the customisation of the customer is lost :|

In CustomerTicketMessage.dtl this is an example of the customized part - according to crythias' howto ...

Code: Select all

switch ($('#Dest').val() ) { 
      case "5\|\|New Employee": // need to slash escape the pipes
            document.compose.Subject.value = "New Employee *Name Surname*";
            document.compose.RichText.value = "Dear IT,<br/><br/>Please be kind to create the following email address:<br/>Name :<br/>Position :<br/>Company :<br/>Phone Number :<br/>Location :<br/><br/>Thanks<br/>";
   break;

// [ ... some other definitions for specific queues ...]

    default:
}
and this is the original part, to handle the operation of attach a file to the ticket:

Code: Select all

                <div>
                    <label for="Attachment">$Text{"Attachment"}:</label>
                    <input name="file_upload" id="Attachment" title="Attachment" type="file" size="40" />
                    <input type="hidden" id="AttachmentUpload" name="AttachmentUpload" value="0" />
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#Attachment').bind('change', function (Event) {
        var $Form = $('#Attachment').closest('form');
        Core.Form.Validate.DisableValidation($Form);
        $Form.find('#AttachmentUpload').val('1').end().submit();
    });
//]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:Attachment -->
                    <div class="Attachment">
                        $QData{"Filename"} <span>$QData{"Filesize"}</span>
                        <button type="submit" name="AttachmentDelete$QData{"FileID"}" value="$Text{"Delete"}">$Text{"Delete"}</button>
                    </div>
<!-- dtl:block:Attachment -->
                    <div class="Clear"></div>
                </div>


I am not so skilled with javascript but I think that this specific issue could be solved with some smart code adaptation

Any help ( crythias, if you are online, knock once for 'yes' please :) ) ... will be really, really, really appreciated.

Giulio
OTRS 6.0.x on CentOS 7.x with MariaDB 10.2.x database connected to an Active Directory for Agents and Customers.
ITSM and FAQ modules installed.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: reset of subject and body on attachment load

Post by crythias »

if the new javascript code puts .value=none somewhere on load, you may have to check that out and ignore it.

I don't know if I can address this particular issue.
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
Locked