Help Desk Software & Beyond
October 23, 2017, 10:30:09 PM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [MOD] 'Responder Name' (TTX v 2.23 & up)  (Read 5476 times)
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« on: September 24, 2007, 11:26:30 PM »

There's a feature already built-in to TTX that allows a customer when replying to a ticket to enter their name.  VERY handy in case the ticket responder is not the ticket creator, like some other third party (Cc: mod?) whose given access to the ticket.

In the ttxcfg.cgi file, add this line...

Quote
askforname=1

Now when the customer sees the ticket, they'll see an additional box to fill out called "Your name:".  Not really a problem since URLs in the response emails will contain the following which forces the box to already be filled in.

Quote
../ttx/ttxcgi?cmd=ticket&key=601Z1575425948663941039&respondername=customername

But what if the customer or anyone else accesses the ticket by entering the long Ticket Key through the online Keyform instead of the properly encoded URL?  Then they'll see a blank box called "Your name:" and be prompted to enter their name along with submission.  Probably not an issue but, as you all know, getting the customer to fill out yet another box could present more issues.

I have a very simple Javascript solution.  When the Ticket page loads, it looks at the "Your name:" box to see what's inside.  If it's empty, it places the ticket owner's name in it automatically.  Anyone with access to the ticket will see that name and can either leave it alone or overwrite it with their own name.

Not for everyone and I'm not yet sure myself if I want it always filled in or not.

In case you do want it pre-filled always....

In the ticket.html template, add the following Javascript to the very end of the file.

Quote
<script language="JavaScript"><!--
responder = "(%TICKET_name%)";
if (document.getElementById('respondername')){
  if (document.getElementById('respondername').value == ""){
      document.getElementById('respondername').value = responder;
  }
}
//--></script>

In the TTXTicket.pm file, change the following line by adding the part in red...

Quote
$data->{TRACKTIME} .= '<b>[%Your name%]:</b>&nbsp;&nbsp;'.
                           "\n<input type=text size=25 name=respondername id='respondername' value=\"$nm\"><br><br class=tiny>";
« Last Edit: January 16, 2008, 05:36:08 PM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #1 on: October 07, 2007, 01:22:22 PM »

Use a cookie and your customer's name will be filled out no matter whose ticket they're invited to visit.

Don't forget all the original edits from the post above... plus do the following...

In the ticket.html template, replace just the Javascript from above with the following...

Quote
<script language="JavaScript"><!--
  if (document.getElementById('respondername')){
    ticketowner = "(%TICKET_name%)";
    namefromURL = document.getElementById('respondername').value;
    if  (document.cookie){
        // get cookie named 'thename'
       responder = get_cookie('thename');
    }
    // fill in the field
    if (responder != ""){
      document.getElementById('respondername').value = responder;
    } else if (namefromURL != "") {
      document.getElementById('respondername').value = namefromURL;
    } else {
      document.getElementById('respondername').value = ticketowner;
    }
}
//-->
</script>

New - Add the following to the top of the same page...

Quote
<script type="text/javascript"><!--
//Get cookie routine by Shelley Powers
      function get_cookie(Name) {
        var search = Name + "="
        var returnvalue = "";
           if (document.cookie.length > 0) {
          offset = document.cookie.indexOf(search)
          // if cookie exists
             if (offset != -1) {
              offset += search.length
            // set index of beginning of value
              end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
               if (end == -1) end = document.cookie.length;
               returnvalue=unescape(document.cookie.substring(offset, end))
               }
            }
        return returnvalue;
      }


function submitMsg(){
  //  check to see if box is available
  if (document.getElementById('respondername')){
      //  make sure box is not empty
      if (document.getElementById('respondername') != ""){
      // write cookie named 'thename'
      var name = document.getElementById('respondername').value;
      var the_date = new Date("December 31, 2023");
      var the_cookie_date = the_date.toGMTString();
      var the_cookie  = "thename="+name+";";
      var the_cookie  = the_cookie+"expires="+the_cookie_date+";";
      var the_cookie  = the_cookie+"path=/;";
      document.cookie = the_cookie;
      }
  }
  document.forms['newticket'].submit();
}   

//-->
</script>


Find this code and add the part in red...

Quote
<input type=submit value="[%Add message%]" onclick="submitMsg()">


Now when Jane Doe visits her first ticket for the very first time, the "your name" field will always be automatically populated with her name.  When she hits "submit", the cookie is saved.  Now no matter what ticket she visits, even a ticket owned by another customer (by invitation only), the "your name" field will contain her name.  She can override it at any time and the new value will stay in the cookie.

The "your name" field will ALWAYS be populated with a name in this order...

1.  Value from the cookie. (saved from previous ticket posting)
2.  No cookie?  Then the value from the name embedded in the URL from the email link.  (default TTX behavior)
3.  No name in URL?  Then the customer name from inside the Ticket.
4.  Wrong name in field?  Customer can type in new name and it's saved in cookie. (see #1)
« Last Edit: October 08, 2007, 10:31:02 AM by sparky672 » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
graybeard
Newbie
*

Karma: 0
Posts: 15


View Profile
« Reply #2 on: April 14, 2016, 01:41:39 PM »

Cannot find this line in ticket.html

<input type=submit value="[%Add message%]" onclick="submitMsg()">
Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #3 on: April 14, 2016, 04:06:42 PM »

Cannot find this line in ticket.html

<input type=submit value="[%Add message%]" onclick="submitMsg()">

It might look like this...

Code:
<input type=submit value="Update">

The important thing to remember is that you're simply adding an onclick handler to the submit button that adds a message to the ticket.

However, if you're modifying the correct version of TTX, it should look like this...

Code:
<input type=submit value="[%Add message%]">
« Last Edit: April 14, 2016, 04:08:19 PM by Sparky » Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.022 seconds with 20 queries.