osTicket 1.9.12Ubuntu 14.04 LTSApache 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

20 days later

I just grepped "Signal" in class.ticket.php and found these:         Signal:('model.updated', $this);        Signal:('ticket.create.before', null, $vars);        Signal:('ticket.create.validated', null, $vars);        Signal:('model.created', $ticket);So, those are the signals you can play with. Which is awesome, didn't know they were there!

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

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:('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 TicketSignal:('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.

Write a Reply...