This MOD leverages the Canned responses system to automatically populate the subject & issue field on newly created staff tickets to autofill. Almost Got this mod in working order...but i can't figure out why i can't get the subject & issue text boxes to populate.

I can easily add the 'response' field in the subject and issue field.... I really don't understand what i'm missing. Attached is a Log of my changes, along with a screenshot of where i'm at currently.

Here are my changes:

MyPHPAdmin

ALTER TABLE `ost_canned_response` ADD `subject` TEXT NULL DEFAULT NULL

ALTER TABLE `ost_canned_response` ADD `issue` TEXT NULL DEFAULT NULL

class.canned.php

Below ',response='.db_input($vars).

',subject='.db_input($vars). //RJS

',issue='.db_input($vars). //RJS

cannedresponse.inc.php - Line 73 ish - ADD

<br><br><div><b>Subject</b><span class="error">*&nbsp;<?php echo $errors; ?></span></div>

<input type="text" size="70" name="subject" value="<?php echo $info; ?>">

<br><br><div><b>Issue:</b> <font class="error">*&nbsp;<?php echo $errors; ?></font></div>

<textarea name="issue" cols="21" rows="12" style="width: 80%;"><?php echo $info; ?></textarea>

scp/js/scp.js - Line 190 - Added lines commented with //RJS

Now this is the section of Code that controls the autofill Feature for the "canned response" text field when you select a canned response. The way it is currently configured it will autofill the Canned response field for the subject, issue and response text field on open tickets ( as shown in the screenshot ). I've tried changing this to to pull in my newly created subject & issue columns...but to no avail. I've tried to change the below to something like... $('#issue',fObj).val(canned.issue); - doesn't work.

This MOD is so close to working, I just don't know enough about PHP to figure this last bit out...Please Help!!

//Canned response.

if(canned.response) {

if($('#append',fObj).is('') && $('#response',fObj).val())

$('#response',fObj).val($('#response',fObj).val()+"\n\n"+canned.response+"\n");

else

$('#response',fObj).val(canned.response);

$('#subject',fObj).val(canned.response); // RJS

$('#issue',fObj).val(canned.response); //RJS

Include/staff/Ticket-open.inc.php - Line 216 / 219 ish

Add to existing Text Fields for Subject & issue

id="issue"

id="subject"

I've attached all the modded files from a fresh 1.7 install as well for anyone brave enough to try and help me sort this out.

Thanks~

osTicket_Canned_Responses_Autofill.jpg

[Canned Response Autofill.zip](https://forum.osticket.com/assets/files/migrated/e/a80dd0da98451e68c0c87eea2b0a2a7.zip)

Resolved issue! Creating Thread for this MOD in 1.7 MODS section.

Write a Reply...