Home > osTicket > New Response Alert for All Department Members in osTicket v1.6 RC5

New Response Alert for All Department Members in osTicket v1.6 RC5

This following modification is being intended to answer the question about the similar modification that asking about the title of this article. You may enable or disable this feature from admin panel. If you want your osTicket also send an alert to all department members when new response that being sent by staff comes to the system, then this following modification is for you!

  1. First of all, you have to alter the ost_config table by adding a new field named note_alert_dept_members. You may use this SQL script from phpMyAdmin or your another MySQL tool. Please note that ost_ is the table name prefix. Adjust it by yourself in case it differs with yours:

    ALTER TABLE ost_config 
    ADD COLUMN `note_alert_dept_members` tinyint(1) default 0 NOT NULL;
  2. Open your \include\staff\preference.inc.php file, and find this code:

    435
    
                  <input type="checkbox" name="note_alert_dept_manager" <?=$config['note_alert_dept_manager']?'checked':''?>> Department Manager (spammy)

    then after the last line of that code, please insert this following code:

    436
    
                  <input type="checkbox" name="note_alert_dept_members" <?=$config['note_alert_dept_members']?'checked':''?>> Department Members (spammy)
  3. Open your \include\class.config.php file, and find this code:

    322
    323
    324
    
        function alertDeptManagerONNewNote() {
            return $this->config['note_alert_dept_manager']?true:false;
        }

    then after the last line of that code, please insert this following code:

    326
    327
    328
    329
    
        // MOD Alert Dept Members on New Note, added by Masino Sinaga, November 14, 2009
        function alertDeptMembersONNewNote() {
            return $this->config['note_alert_dept_members']?true:false;
        }

    Find again this code:

    476
    477
    478
    479
    
            if($var['note_alert_active']
                    && (!isset($var['note_alert_laststaff'])
                        && !isset($var['note_alert_assigned'])
                        && !isset($var['note_alert_dept_manager']))){

    then replace with this following code:

    476
    477
    478
    479
    480
    
            if($var['note_alert_active']
                    && (!isset($var['note_alert_laststaff'])
                        && !isset($var['note_alert_assigned'])
                        && !isset($var['note_alert_dept_manager'])
    		    && !isset($var['note_alert_dept_members']))){ // added by Masino Sinaga, Nov 14, 2009

    Find again this code:

    536
    
                ',note_alert_dept_manager='.db_input(isset($var['note_alert_dept_manager'])?1:0).

    then replace with this following code:

    536
    537
    
                ',note_alert_dept_manager='.db_input(isset($var['note_alert_dept_manager'])?1:0).
                ',note_alert_dept_members='.db_input(isset($var['note_alert_dept_members'])?1:0).  // added by Masino Sinaga, Nov 14, 2009
  4. Open your \include\class.ticket.php file, and find this code:

    827
    828
    829
    
                            //Dept manager
                            if($cfg->alertDeptManagerONNewNote() && $dept)
                                $recipients[]=$dept->getManager();

    then after the last line of that code, please insert this following code:

    831
    832
    833
    834
    835
    836
    837
    838
    
                            //Dept members, added by Masino Sinaga, Nov 14, 2009
                            if($cfg->alertDeptMembersONNewNote() && $dept) {
                                $sql='SELECT staff_id FROM '.STAFF_TABLE.' WHERE onvacation=0 AND dept_id='.db_input($dept->getId());
                                if(($users=db_query($sql)) && db_num_rows($users)) {
                                    while(list($id)=db_fetch_row($users))
                                        $recipients[]= new Staff($id);
                                }													
    			}

That’s all. Hope it helps you.

  • Share/Bookmark
260 views Print This Post Print This Post

  1. Dileepa Navaratne
    November 19th, 2009 at 17:08 | #1

    Hi Masino,

    Is it possible to modify this to alert when different department members replies to the ticket ?, I’ve noticed that when two departments are involved in one ticket , for example if department A and B are involved in a ticket, if member from department A reply to the ticket only members from the department A get the alert, can it be modified so that members from department B also get the alert ?.

    Kind Regards,
    Dileepa.

  2. November 19th, 2009 at 20:24 | #2

    Hi Dileepa,

    Thanks for your feedback. I will try to implement it. Stay tuned. :-)

  3. Dileepa Navaratne
    January 8th, 2010 at 20:14 | #3

    Hi Masino,

    Any updates on my request.

    Kind Regards,
    Dileepa.

  4. January 9th, 2010 at 12:14 | #4

    Hi Dleepa,

    I am so sorry, I still have not had time to update the modification above.

  5. Daniel
    June 22nd, 2010 at 05:24 | #5

    Thanks for the code. It works well, but one thing:

    When posting an internal note I was getting an error message: “Error(s) occured. Unable to post the note.” But the note was actually posting just fine. The problem was that the variable $id in the postNote function in class.ticket.php (modified in the last code snippet of your post) was getting overwritten by your new code. I replaced $id with another variable name and it seems to be working fine now.

  1. No trackbacks yet.