Tracking ID

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Tracking ID

Post by steve »

Hi,

I am trying to edit the way HESK generates my Tracking ID's.

I want it to be YYYY-MM-DD-001, where the first ticket created in a day is 001, then each subsequent ticket created that day is increased by one.

Example,

First tracking ID of today would be 2012-04-23-001, throughout the day we created 4 tickets, so the last Tracking ID of the day would be 2012-04-23-004

Here is what I have so far.

Code: Select all

    /* Generate the ID */
    $trackingID  = '';
    $trackingID .= date(Y);
    $trackingID .= '-';
    $trackingID .= date(m);
    $trackingID .= '-';	
    $trackingID .= date(d);
    $trackingID .= '-';	
    $trackingID .= ????;
    $trackingID .= ????;
    $trackingID .= ????;
-Steve
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Tracking ID

Post by Klemen »

Unless you want anyone to access your tickets I would advise against doing so and keep tracking IDs completely random.

That said, your task is not as simple as it seems on the first glance.

Here's how the programming logic should work:
- get latest ID from the database
- get the last part of the ID (you can use explode() function)
- increase this part by 1
- generate new ID using this part
- insert ticket into database

You would also need to change length values of database fields that hold tracking ID values (`trackid` in tickets table, `ticket_id` in attachments), modify function hesk_cleanID() to allow more than 13 chars etc.

Unless MySQL automatically generates IDs (and it can't in such format) there is also the slim chance of duplicate ticket IDs if two requests are submitted at the same time...
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
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Tracking ID

Post by steve »

Thank you for that reply, I thought it might be a little more difficult than it seamed. Ill post any successes i have with that.

I have disabled the customer interface of HESK for my application, so you cannot view tickets without a username and password.
-Steve
Post Reply