Page 1 of 1
Tracking ID or ID
Posted: Wed Jul 04, 2012 8:10 am
by buitenzorg1979
how to custom trackingID or ID like :
(companyName_fourRandomDigits_customerID)
companyName_customerID_date_Autonumber
e.g
Oracle_345_20070106_0001
Re: Tracking ID or ID
Posted: Wed Jul 04, 2012 4:22 pm
by steve
To Change your Hesk ID you need to modify /inc/common.inc.php
around line 158 you will find
Code: Select all
/* Generate the ID */
$trackingID = '';
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= '-';
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= '-';
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
$trackingID .= $useChars[mt_rand(0,29)];
Change that around to your liking.
Mine looks like this
Code: Select all
/* Generate the ID */
$trackingID = '';
$trackingID .= date(Y);
$trackingID .= '-';
$trackingID .= date(m);
$trackingID .= '-';
$trackingID .= date(d);
$trackingID .= '-';
$trackingID .= mt_rand(0,9);
$trackingID .= mt_rand(0,9);
Re: Tracking ID or ID
Posted: Wed Jul 04, 2012 6:14 pm
by Klemen
Just a note: using this method could possibly lead to duplicate ticket IDs being generated.
Re: Tracking ID or ID
Posted: Wed Jul 04, 2012 6:26 pm
by steve
In the event more than 99 tickets are created in a day?
Re: Tracking ID or ID
Posted: Wed Jul 04, 2012 8:41 pm
by Klemen
Actually, just two tickets might be enough to get a duplicate.
The
will randomly generate a digit from 0 - 9. This is the only random part of your ticket ID for a given day.
You use two random digits so have 100 possible combinations. This means you have a 1% chance that the second generated ID will be the same as the first one.
If you receive on average 2 tickets per day that means you will have on average 1 duplicate every 100 days. If you receive 10 tickets per day you will have a duplicate on average once per 10 days.
Re: Tracking ID or ID
Posted: Wed Jul 04, 2012 10:45 pm
by steve
Very interesting, so I guess the solution would be to add another random digit to the end, that would substantially lower the odds of duplicates?
Re: Tracking ID or ID
Posted: Thu Jul 05, 2012 9:59 am
by Klemen
That would make it a 0,1% possibility.
However, another important thing you have to consider is privacy and security of your customer's information.
A random ID actually serves as a password as it has millions and millions of possible combinations and is extremely hard to just guess. Your tracking ID on the other hand is easy to guess - all I need to do is try 100 possible combinations for a date and I will have access to a ticket submitted by another customer and possibly sensitive information within the ticket.
Re: Tracking ID or ID
Posted: Thu Jul 05, 2012 5:41 pm
by steve
Thanks for the heads up!
I have disabled the customer interface, the only way to view a ticket is to have a user login. So for my purposes ill take the 0,1% probability.
Going forward, Ill be sure to mention the security risk involved in my method.