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

Custom Signals

The plugin I am currently working on needs to perform some actions after the ticket has been assigned.
I know there aren't currently any signals to connect to for ticket assignment, so I was trying to add my own signal to the end of the onAssign function inside class.ticket.php.


$info = array('agent' => $staff);
Signal::send('ticket.assign', $this, $info);

I have also used a couple of variations of the Signal::send line but after connecting to the signal in my plugin's bootstrap function, it never fires.
I am able to connect to and use other Signals like model.created, it's just that my custom signal never fires.
I just can't seem to crack this one :(
Tagged:

Comments

  • Hmm, you can't pass $staff from onAssign, it doesn't exist, but you can pass $assignee. (It's scoped to the foreach, unless you're sending for each alert recipient?).

    You probably want to send your Signal before the cfg check for notifications.. if that is off, then it won't get to your signal. I'm thinking before the Note posting just after the is_object check on $assignee would work.

    // The assignee could be a team or an agent, unless you do:
    if($assignee instanceof Staff){
        $info = array('agent' => $assignee);
        Signal::send('ticket.assign', $this, $info);
    }

    I would generally print_r($info); die("Tests mate"); in my bootstrap until I get it working YMMV.
Sign In or Register to comment.