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

This following modification is being intended to answer the question on osTicket Discussion Forum that asking about the title of this article. If you want your osTicket also send an alert to all department members when new message comes to the system, then you may use this following modification I created.

  1. First of all, you have to alter the ost_config table by adding a new field named message_alert_dept_members. You may use this SQL script from phpMyAdmin or your another MySQL tool:
    ALTER TABLE ost_config 
    ADD COLUMN `message_alert_dept_members` tinyint(1) default 0 NOT NULL;
  2. Open your \include\staff\preference.inc.php file, and find this code:
    425
    
                  <input type="checkbox" name="message_alert_dept_manager" <?=$config['message_alert_dept_manager']?'checked':''?>> Department Manager (spammy)

    after that line, please insert this following code:

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

    306
    307
    308
    
        function alertDeptManagerONNewMessage() {
            return $this->config['message_alert_dept_manager']?true:false;
        }

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

    310
    311
    312
    313
    
        // MOD Alert Dept Members on New Message, added by Masino Sinaga, October 23, 2009
        function alertDeptMembersONNewMessage() {
            return $this->config['message_alert_dept_members']?true:false;
        }

    Find again this code:

    469
    470
    471
    472
    
            if($var['message_alert_active']
                    && (!isset($var['message_alert_laststaff'])
                    && !isset($var['message_alert_assigned'])
                    && !isset($var['message_alert_dept_manager']))){

    then replace with this following code:

    469
    470
    471
    472
    473
    
            if($var['message_alert_active']
                    && (!isset($var['message_alert_laststaff'])
                    && !isset($var['message_alert_assigned'])
                    && !isset($var['message_alert_dept_manager'])
    		&& !isset($var['message_alert_dept_members']))){  // added by Masino Sinaga, Oct 23, 2009

    Find again this code:

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

    then replace with this following code:

    532
    533
    
                ',message_alert_dept_manager='.db_input(isset($var['message_alert_dept_manager'])?1:0).
                ',message_alert_dept_members='.db_input(isset($var['message_alert_dept_members'])?1:0).  // added by Masino Sinaga, Oct 23, 2009
  4. Open your \include\class.ticket.php file, and find this code:
    659
    660
    661
    
                                //Dept manager
                                if($cfg->alertDeptManagerONNewMessage() && $dept)
                                    $recipients[]=$dept->getManager();

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

    662
    663
    664
    665
    666
    667
    668
    669
    
                                //Dept members, added by Masino Sinaga, Oct 23, 2009
                                if($cfg->alertDeptMembersONNewMessage() && $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. Let me know your feedback. Hope it helps you and good luck!

Share

896 viewsPrint This Post Print This Post

Comments

  1. Russ Smith says:

    I have added this code, double checked it – yet it doesn’t appear to be working. When I add a reply to a ticket, that reply should go to all the staff members emails right?

  2. @Russ Smith

    Let me clarify about the code. As the title stated, this modification is intended to send alert to the department members only on new message. It meant that each time message that sent from client by replying the ticket, then all department members will get the notify via staff members email.

    By contrast, if the staff reply to the ticket, department members will never received email since osTicket create a new response (and not create a new message in osTicket).

    So, to answer your question, it depends on who replies the ticket. If the staff reply the ticket, then they will never get the notify via email. But, if client reply the ticket, then all department members will get the notify via email.

    Hope it makes sense.

  3. Dileepa Navaratne says:

    Hi Masino, Fist Thanks for the awesome work on the osticket , Just one questions, is there any solution from you for the above question , alert department members on new response ? not new messages.
    Thanks.

  4. @Dileepa Navaratne

    Sure. I will try to make the modification you requested.

  5. @Dileepa Navaratne

    As I promised a few minutes ago, you may now get the modification code as you requested from: New Response Alert for All Department Members in osTicket v1.6 RC5. Hope it helps you, and let me know your feedback. Thanks.

  6. Dileepa Navaratne says:

    Hi Masino,

    Thanks for the mod, it works, you’re doing a great help to all the os ticket users.

    Many Thanks.

  7. You’re welcome, Dileepa. :-)

  8. Alex says:

    Hi!

    Did anyone try this mod for the latest osticket version 1.6 ST?

    Regards

    Alex

  9. Gareth Hennedy says:

    Guys,

    As far as I can see this only adds funtionality to the ‘New Internal Note Alert’ function.

    What I am looking for is functionality where is any staff member or the customer adds data in the form of ‘New Message Alert’ then an email is sent to all staff, even staff memebers that are not assigned to the cases as well as the customer.

    Any ideas?

    Thanks

    Gareth

Trackbacks

  1. [...] Go to comments 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 [...]

Speak Your Mind

*


*