Hi,i want to achieve 3 different ticket states to get a better overview of all our tickets:Openonly for new, unanswered ticketsIn Progresswith two sub-status:- In Progress (Action required by Support-Team)- In Progress (Action required by Customer)Closedwith the default:- Closed- ResolvedIn my point of view i need to do the following:Add the statuses at: Admin Panel -> Manage -> Lists -> Ticket StatusesDONEMake sure that the ticket status is set to "In Progress (Action required by Customer)" by default when an agent replies:DONE (this just selects always this status by default in the drop down field - see attachment)If someone is interested in this, here is what i changed (green color). Please note that you will have to find out the ID of the status you want to set via your database (table os_ticket_status or similar, depending on your prefix "os_").File:/var/www/html/osticket/include/staff/ticket-view.inc.phpforeach (TicketStatusList:(   array('states' => $states)) as $s) {       if (!$s->isEnabled()) continue;+      $current = ($statusId == $s->getId()); //added this line+~     $selected = ('8' == $s->getId()); //changed this line       echo sprintf('<option value="%d" %s>%s%s</option>',                    $s->getId(),                    $selected ? 'selected="selected"' : '',                    __($s->getName()),                    $current ? (' ('.__('current').')') : '' //renamed variable here                    );Make sure that the ticket status is set to "In Progress (Action required by Support-Team)" by default when a customer replies:Which file do i need to edit here? Simplest solution would be to change the SQL Query when the reply gets written in the database, but i can't find the right file.Thank you for your help!

default status selected.PNG

Hello!Have you managed to do this?I could use it very well.Thank youBest regards

Hino, not yet. I still need to figure out which file i need to edit.Any help would be appreciated :)Best regards

You could achieve this with a plugin easily, rather than modifying core. Intercept the thread entry creation signal and change the ticket status accordingly.

Hi Grizly,could you please give me an advice on how to intercept the thread entry creation signal?Thank you!

Hey chief, checkout https://github.com/clonemeagain/osticket-slack/blob/master/slack.php for an example of intercepting/using the ThreadEntry Signal.To change a ticket's status, you'll need to load the desired TicketStatus object and apply it to the Ticket object, example here:Loading TicketStatus from config:https://github.com/clonemeagain/plugin-autocloser/blob/master/class.CloserPlugin.php#L100Applying TicketStatus to Ticket:https://github.com/clonemeagain/plugin-autocloser/blob/master/class.CloserPlugin.php#L220You don't have to do it that way, if you know exactly which ones you want to alternate between, you could use something like:// Check if this thread entry was created by clients:if ($entry instanceof MessageThreadEntry) {    $new_status = TicketStatus:('id_of_waiting_for_agent_status');}elseif ($entry instanceof ResponseThreadEntry) {    $new_status = TicketStatus:('id_of_waiting_for_client_status');}else {// this is a system message or NoteThreadEntry, so we should assume this shouldn't change the state    return;}// don't change if already the same status:if ($ticket->getStatusId() != $new_status->getId()) {    $ticket->status = $new_status;    $ticket->save;}So, if you make a new plugin, use the Bootstrap method to listen for Signal 'threadentry.created', then run the above on the $entry. The fun part is fetching the Ticket from the $entry. The slack plugin above includes a method that fetches it from the $entry, you might want to grab a copy.Let me know if you need a hand, or if you're having trouble getting it going, if you want to use a Plugin Config screen, you can copy those from my plugins too, (they even include examples of Status drop-downs!). There are examples of logging the Event in the thread in the Closer Plugin, which might be useful for statistics later on.Enjoy!

Write a Reply...