I am trying to show all old messages in a ticket in Response email template.I tried this MOD http://forum.osticket.com/d/discussion//mod-show-ticket-thread-on-email but its written for osticket 1.6.x and I am running osticket 1.9.15I am determined to get email threads (history) shown in our replies to customers. Any help is greatly appreciated.

This is not a feature of the UI at this time, and I do not know of a way to do this easily.You could however print the ticket to PDF and attach the .pdf to the next response if you only needed to do it once in a while.

No, I actually want to do it for every response. As you can see the link from my previous message, I just need directions on how to make it work for osticket 1.9.15Thanks.

I would point you to the link that you already provided.  You would need to look at 1.6 and see what the differences are between it and the version that you are running.  Then you would need to update the mod to work with your version.  I cannot really provide you with any more direction than that as this is not something that I have ever endeavored to do.  

2 years later

I know it has been suggested from time to time: http://forum.osticket.com/d/discussion//complete-history-in-ticket-reply  Keywords: full thread in answers, allThis is also a feature request from us.

2 months later

I wrote some code to add the full thread to the ticket email response. v 1.10.1

Add a new method in class.ticket.php.

function addMessageThread($body){
    $sql = 'SELECT ost_thread_entry.id, poster, body, FORMAT, ost_thread_entry.created  FROM ost_thread, ost_thread_entry 
    WHERE  ost_thread_entry.thread_id = ost_thread.id AND object_id = ' . $this->getId()  .'
    ORDER BY ost_thread_entry.created DESC';

    $result = db_query($sql);

    $i=0;
    while ($row = $result->fetch_assoc()) {
        if($i > 0) {
            $body .= '<br/><br/><b>' . $row['poster'] . ' ' . date_format(date_create($row['created']), 'd-m-Y g:i A') . '</b><br/>';
            $body .= $row['body'];
        }                        
        else 
            $body .= "<br/><br/><h2>THREAD</h2>";

        $i=$i+1;
    }

    return $body;
}

modify the method postReply, near line 2582.

      //....
     $user = $this->getOwner();
    if (($email=$dept->getEmail())
        && ($tpl = $dept->getTemplate())
        && ($msg=$tpl->getReplyMsgTemplate())
    ) {
        $msg = $this->replaceVars($msg->asArray(),
            $variables + array('recipient' => $user)
        );
        $attachments = $cfg->emailAttachments()?$response->getAttachments():array();

        //Add this lines
        $body = $msg['body'];

        //Includes thread. 
        if($vars['includeThread'] == 'on')
            $body = $this->addMessageThread($body);

        $email->send($user, $msg['subj'], $body, $attachments,
            $options);
    }

Modify file ticket-view.inc.php. Near line 730.

<p  style="text-align:center;">            
        <!--Add this line-->
        <br/><br/><input type="checkbox" name="includeThread" /> Include Thread <br/><br/>
        <input class="save pending" type="submit" value="<?php echo __('Post Reply');?>">
        <input class="" type="reset" value="<?php echo __('Reset');?>">            
    </p>
2 months later

the above code is not working , i need to include the whole thread in the every email conversation how to do that

4 months later

Thank you diegomesa.

This code works osTicket (v1.9.12):

Add a new method in class.ticket.php.

function addMessageThread($body) {    
$sql = 'SELECT poster, body FROM '.TICKET_THREAD_TABLE.' WHERE ticket_id=' .db_input($this->getId()) .' ORDER BY created DESC'; $result = db_query($sql); $i=0; while($row = db_fetch_array($result)) { if($i > 0) { $body .= '<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">'; $body .= $row['body']; $body .= '</div>'; } else { $body .= "<br/><br/><h2>THREAD:</h2>"; } $i=$i+1; } return $body; }

modify the method postReply, near line 2007.

$body = $this->addMessageThread($msg['body']);
$email->send($this->getOwner(), $msg['subj'], $body, $attachments, $options);
8 months later

Anyone suggest how this can be configured in osTicket v1.14.1.We are eagerly looking for this

a month later
Write a Reply...