NOTE: THIS MOD HAS BEEN WRITTEN FOR OST 1.6 RC5 ONCE I UPGRADE I WILL NOTE ANY CHANGES HERE
UPDATE: I have made this code a bit better and added a couple more functions. The info below reflects the new changes.
I was in need of a way for staff who where not in house to be able to see ticket messages as they where assigned and viewed on smart phones. problem was that the links sent with the assignment email are not accessible from outside of the company network (security reasons). So I wrote few changes in to the code to send all messages with the assigned ticket id in all ticket assignment emails.
Follows these steps carefully and backup your files before you edit them!
The first file to edit is class.ticket.php
1
var $overdue;
add
var $ticket_text;
var $ticket_notes;
var $ticketResponses;
2
function getLastMsgId() {
return $this->lastMsgId;
}
inset the following
function getMsgText() {
$this->setMsgText($this->id);
$out =$this->ticket_text ."\n\n";
$out .=$this->getTicketResponses();
return $out;
}
function getInternalNotes(){
$this->setTicketNotes($this->id);
return $this->ticket_notes;
}
function getTicketResponses(){
$this->setTicketResponses($this->id);
return $this->ticketResponses;
}
function setMsgText($id) {
$query = "select message,created from ".TICKET_MESSAGE_TABLE." where ticket_id = $id";
$ticket_text = "Customer Messages:\n\n";
$result = db_query ( $query );
while ( $resp_row = db_fetch_array ( $result ) ) {
$ticket_text .= "Created: ".$resp_row."\n";
$ticket_text .= "Message:\n ".$resp_row."\n"; }
$this->ticket_text = $ticket_text;
}
function setTicketNotes($id){
$out = "No Internal Notes\n\n";
$query ='SELECT note_id,title,note,source,created FROM '.TICKET_NOTE_TABLE.' WHERE ticket_id='.db_input($id).' ORDER BY created DESC';
if(($resp=db_query($query)) && ($notes=db_num_rows($resp))){
$out = "Internal Notes (". $notes .")\n\n";
while($row = db_fetch_array($resp)) {
$out .= "Date Posted: ".$row."\n";
$out .= "Posted by: ".$row."\n";
if($row) {
$out .= $row ."\n";
}
$out .= $row ."\n\n";
}
}
$this->ticket_notes = $out;
}
function setTicketResponses($id){
$query = "SELECT * from ".TICKET_RESPONSE_TABLE." WHERE ticket_id = $id ORDER BY created DESC";
$out = "Responses\n";
$result = db_query ( $query );
while ( $resp_row = db_fetch_array ( $result ) ) {
$out .= "Date Posted: ".$resp_row ."\n";
$out .= "Posted By: ".$resp_row ."\n";
$out .= $resp_row ."\n\n";
}
$this->ticketResponses = $out;
}
3
'/%createdate/', '/%duedate/', '/%closedate/', '/%url/');
with
'/%createdate/', '/%duedate/', '/%closedate/', '/%url/', '/%msg/', '/%internal/' );
4: after
Format:($this->getCloseDate()),
$cfg->getBaseUrl ()
insert
,
$this->getMsgText(),
$this->getInternalNotes() REMEMBER THE COMMA (,)
5: Save class.ticket.php.
6: open templates.inc.php
7: under
<tr><td>%url</td><td>osTicket's base url (FQDN)</td></tr>
insert
<tr><td>%msg</td><td>Ticket messages.</td></tr>
<tr><td>%internal</td><td>All Internal Ticket Notes.</td></tr>
9: save templates.inc.php
Now when you go to Admin Panel > Emails > Templates you will see 2 new tags under 'Other Variables' called %msg and %internal. Simply place these in your templates as with any other and your good to go. This will attach all message ticket text, responses and internal associated with the given ticket.
%msg inserts public messages and %internal attaches all internal notes.