Jump to content

stop ticket status from changing


snake

Recommended Posts

It is a common requirement that I will need to follow up on a ticket or just tell client "I am working on it", so I want to stop the ticket status from being changed to "answered" when I reply to tickets, so it has to be changed manually.

After some 15 years using WHMCS, it is clear that nobody can remember to change the status before submitting, so I need to create a hook that will do this, otherwise tickets just end up being forgotten or auto closed.

I see that I can hook into this here
https://developers.whmcs.com/hooks-reference/ticket/#ticketadminreply

but what would the required hook code be?

 

 

Link to comment
Share on other sites

You could have all tickets change to a certain status when an admin replies to them, e.g. In Progress. If you don't like In Progress then you could create a new ticket status (System Settings > Support > Ticket Statuses) and set it to not auto close and show in the active tickets/awaiting reply tickets. Just change the status in the hook below to match.

<?php

use WHMCS\Database\Capsule;

function set_ticket_status_after_reply($vars) {

    $status = 'In Progress';

    Capsule::table('tbltickets')->where('id', $vars['ticketid'])->update([
        'status' => $status
    ]);


}

add_hook('TicketAdminReply', 1, 'set_ticket_status_after_reply');

Or if you prefer to use the API instead of a direct database call

<?php

function set_ticket_status_after_reply($vars) {

    $status = 'In Progress';

    localAPI('UpdateTicket', [
        'ticketid'  => $vars['ticketid'],
        'status'    => $status
    ]);

}

add_hook('TicketAdminReply', 1, 'set_ticket_status_after_reply');

 

Edited by leemahoney3
Link to comment
Share on other sites

I don;t want to automatically change the status at all, I want to leave it as is.

 

So if I am replying to a ticket, which has an open status, I want the status to stay as open, unless I change it.

If the status is "in progress" then I want the status to stay as "in progress" unless I change it.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated