How to Avoid Duplicate Message from Client Saved in osTicket v1.6 RC5

Actually, this modification is similar with another one that I made here: How to Avoid Duplicate Ticket Content in osTicket System. After client post message (reply) to his/her ticket that has been created before, then client reload/refresh that next page, the duplicate message will be saved in database. This modification will avoid that duplicate message saved in database of your osTicket System.

  1. Open \include\class.ticket.php file, and find this code:

    563
    564
    565
    566
    567
    568
    
        //Insert message from client
        function postMessage($msg,$source='',$msgid=NULL,$headers='',$newticket=false){
            global $cfg;
     
            if(!$this->getId())
                return 0;

    after the last line of the code above, add this following code:

    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    
            // Begin of MOD Avoid Duplicate Message from Client Saved in Database
            // Added by Masino Sinaga, May 4, 2009
            $sql1='SELECT ticket_id, message FROM '.TICKET_MESSAGE_TABLE.' 
             WHERE ticket_id='.db_input($this->getId()).'
             AND message='.db_input(Format::striptags($msg)).'';
            $res1=db_query($sql1);                
            if( ($res1 && db_num_rows($res1)) ) {
              return 0;
            }
            // End of MOD Avoid Duplicate Message from Client Saved in Database
            // Added by Masino Sinaga, May 4, 2009
  2. Open tickets.php file, and find this code:

    69
    
                    $errors['err']='Unable to post the message. Try again';

    replace with this following code:

    69
    
                    $errors['err']='Unable to post the message. Make sure the message you will send never sent before. Try again';

Have a nice code!

Share

317 viewsPrint This Post Print This Post

Speak Your Mind

*


*