Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Need a little help with plugin

osTicket 1.9.12
Ubuntu 14.04 LTS

I am working with someone who is creating a slack integration plugin. I am not a coder, I have very little experience with php. Would someone be willing to help me with finding the signals that are called when a ticket is updated, or closed? Also I have a list that I have created and added as a drop down menu for the user to select from when submitting a ticket. I would love to figure out how to have that selection used as a variable to be displayed in a notification. Just not sure how to figure it out. 

Any help would be greatly appreciated


  • edited May 2016
    I just grepped "Signal" in class.ticket.php and found these: 

            Signal::send('model.updated', $this);
            Signal::send('ticket.create.before', null, $vars);
            Signal::send('ticket.create.validated', null, $vars);
            Signal::send('model.created', $ticket);

    So, those are the signals you can play with. Which is awesome, didn't know they were there!
  • edited May 2016
    Full list of Signals seems to be: (From:  grep -r Signal::send *)

    ajax.php:Signal::send('ajax.client', $dispatcher);
    api/http.php:Signal::send('api', $dispatcher);
    apps/dispatcher.php:Signal::send('ajax.client', $dispatcher);
    include/class.mailparse.php:        Signal::send('mail.received', $this, $info);
    include/class.mailparse.php:        Signal::send('mail.decoded', $decoder, $info);
    include/class.auth.php:        Signal::send('auth.login.failed', null, $info);
    include/class.auth.php:        Signal::send('auth.login.succeeded', $staff);
    include/class.auth.php:        Signal::send('auth.logout', $staff);
    include/class.auth.php:        Signal::send('auth.pwreset.login', $staff);
    include/class.auth.php:        Signal::send('auth.pwreset.login', $client);
    include/class.ticket.php:        Signal::send('model.updated', $this);
    include/class.ticket.php:        Signal::send('ticket.create.before', null, $vars);
    include/class.ticket.php:        Signal::send('ticket.create.validated', null, $vars);
    include/class.ticket.php:        Signal::send('model.created', $ticket);
    include/class.cron.php:        Signal::send('cron', $data);
    include/class.export.php:        Signal::send('export.tables', $this, $this->tables);
    include/class.thread.php:        Signal::send('model.created', $entry);
    include/class.osticket.php:        Signal::send('syslog', null, $info);
    include/class.orm.php:        Signal::send('model.deleted', $this);
    include/class.orm.php:            Signal::send('model.created', $this);
    include/class.orm.php:            Signal::send('model.updated', $this, $data);
    include/class.staff.php:            Signal::send('auth.pwchange', $this, $info);
    include/class.staff.php:        Signal::send('model.modified', $this);
    include/class.staff.php:        Signal::send('model.deleted', $this);
    include/class.staff.php:            Signal::send('model.created', $staff);
    include/class.staff.php:        Signal::send('', $this, $info);
    include/class.organization.php:            Signal::send('model.updated', $this);
    include/class.i18n.php:        Signal::send('config.ttfonts', null, $rv);
    include/class.client.php:            Signal::send('auth.pwchange', $this->getUser(), $info);
    include/class.mailfetch.php:        Signal::send('mail.decoded', $this, $info);
    include/class.mailfetch.php:        Signal::send('mail.processed', $this, $vars);
    include/class.faq.php:        Signal::send('model.updated', $this);
    include/class.faq.php:        Signal::send('model.updated', $this);
    include/class.faq.php:                Signal::send('model.created', FAQ::lookup($id));
    include/class.user.php:        Signal::send('', $this->getUser(), $info);
    include/class.signal.php: * the codebase there exists a Signal::send() for the same named signal.
    include/class.signal.php:     * Signal::send('user.login', $this, array('username'=>'blah'));
    scp/ajax.php:Signal::send('ajax.scp', $dispatcher);
    scp/autocron.php:Signal::send('cron', $data);
    scp/dispatcher.php:Signal::send('apps.scp', $dispatcher);

    Edit: Removed my plugins
  • edited May 2016
    I was looking and model.updated is for after an update, as Grizly pointed out.  I didn't see one for close specifically, so I don't know if it's the same signal/event or not.  I guess it's intuitive that close is in the updated signal.  But, the function setStatus could have a custom signal if you wanted before closed updates the database here,

    function setStatus($status, $comments='', $set_closing_agent=true) {
           switch($status->getState()) {
                case 'closed':
                 //new signal
    $myargs = array(
                 'myvariable0' => 'myvalue'
    Signal::send('before.close', $this, $myargs);

    function myCallBackFunction($object, $data){
    echo 'do something just before you update';

    //somewhere in the Ticket class or some class that knows about Ticket
    Signal::connect('before.close', array('Ticket', 'myCallBackFunction'));

    I don't know what that would give you.  Maybe something you can do before you actually close with the update statement.  Could be wrong on the location, but seems right.  That or add a new signal to function update before the model.updated.

    EDIT:  Changed code.
  • Thanks for the info! I will try to figure out how to use it. 
  • I think the updated signal is probably what you want, so you may not want to go with a whole new signal.  My advice is to try what's already available.
Sign In or Register to comment.