Ticket Linking

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
shddcit
Posts: 65
Joined: Wed Mar 30, 2022 3:54 pm

Ticket Linking

Post by shddcit »

If anyone finds it inconvenient to constantly copy the ticket ID (for example, Z6V-TSB-8MJZ) in order to link a ticket, here are the code changes in the admin_ticket.php file.

You need to replace this code (line 725) :

Code: Select all

$res_ticket = hesk_dbQuery("SELECT `id`,`trackid`,`u_email` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets`
     WHERE `trackid` = '".$ticket_track_id."'");
    $get_ticket_data = hesk_dbFetchAssoc($res_ticket);
with the following:

Code: Select all

// Try to determine what the user entered: trackid or just ID
$ticket_track_id = hesk_dbEscape($ticket_track_id);

// If the entered value is a number, search by ID, otherwise by trackid
if (is_numeric($ticket_track_id)) {
    $res_ticket = hesk_dbQuery("SELECT `id`, `trackid`, `u_email` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets`
        WHERE `id` = ".intval($ticket_track_id)." OR `trackid` = '".$ticket_track_id."'");
} else {
    $res_ticket = hesk_dbQuery("SELECT `id`, `trackid`, `u_email` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets`
        WHERE `trackid` = '".$ticket_track_id."'");
}

$get_ticket_data = hesk_dbFetchAssoc($res_ticket);
As a result, no matter what you enter—be it Z6V-TSB-8MJZ or, for example, 17526 (if you have a ticket with that number that you want to link)—the ticket will be linked. In my opinion, it's easier to remember the ticket number than its ID.

P.S. I took up this issue due to mild dissatisfaction among colleagues, as linking by trackid is inconvenient and requires more actions.
Klemen
Site Admin
Posts: 10211
Joined: Fri Feb 11, 2005 4:04 pm

Re: Ticket Linking

Post by Klemen »

Good idea, thanks for sharing. Will include in the next release as well (with just minor changes)
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply