Page 1 of 1

2.3 MOD: Insert Ticket Submitter's Name into Ticket Reply

Posted: Fri Oct 07, 2011 5:18 am
by Lisaweb
In testing the system getting it ready for launch, I noticed that my test users had trouble distinguishing who they were really replying to. If they were going to assign the ticket to another user, they would address the reply to the other user, instead of the addressing the reply towards the customer who originally submitted the ticket. This could be potentially embarrassing.

To keep this from happening, I added code that automatically entered an introduction using the submitter's name into the message reply text box. I also added new line commands (\n\n) so the cursor is positioned exactly where the user would being typing their reply. Canned replies are inserted to the same potion as well, making it lightning fast for the user to reply.
Hello [ticket submitter name],

[canned response]

[signature]
To accomplish this, in admin/admin_ticket.php

Find this line (somewhere near #1018):

Code: Select all

<span id="HeskMsg"><textarea name="message" id="message" rows="12" cols="60"><?php if (isset($_SESSION['ticket_message'])) {echo stripslashes(hesk_input($_SESSION['ticket_message']));} ?></textarea></span></p>
And replace it with this line:

Code: Select all

<span id="HeskMsg"><textarea name="message" id="message" rows="12" cols="60">Hello <?php echo $ticket['name']; ?>,<?php echo ("\n\n");?><?php if (isset($_SESSION['ticket_message'])) {echo stripslashes(hesk_input($_SESSION['ticket_message']));} ?></textarea></span></p>
Auto-inserting the submitter's name reminds the users of whom they are replying to, tremendously lowering the probability of mistakenly replying to another user. And it saves them time as well. :-)



[edited for clarity 10-7-2011 7:30am PST]

Re: 2.3 MOD: Insert Ticket Submitter's Name into Ticket Repl

Posted: Mon Oct 10, 2011 3:05 pm
by franku
Great Mod!

One question for you.

Our customer enter their full name - ie. John Doe.

That means this script mod adds "Hello John Doe,"

Is there a way it can only enter the first name - ie. the characters up to the first space and strip the last name so it comes accross more personal?

Re: 2.3 MOD: Insert Ticket Submitter's Name into Ticket Repl

Posted: Mon Oct 10, 2011 3:33 pm
by Klemen
Something like

Code: Select all

$ticket['just_name'] = $ticket['name'];
$space = strpos($ticket['just_name'],' ');
$space = $space > 0 ? $space : strlen($ticket['just_name']);
$ticket['just_name'] = substr($ticket['just_name'],0,$space);
then use

Code: Select all

$ticket['just_name']
instead of

Code: Select all

$ticket['name']

Re: 2.3 MOD: Insert Ticket Submitter's Name into Ticket Repl

Posted: Mon Oct 10, 2011 3:55 pm
by franku
Worked Like a dream - Thanks to both of you!
:D

Re: 2.3 MOD: Insert Ticket Submitter's Name into Ticket Repl

Posted: Mon Oct 10, 2011 4:22 pm
by Lisaweb
Sweet! I'm gonna code that in today!

Thanks Klemen! :-)