Page 1 of 1
Changing Tracking ID’s In 0.94.1 [RESOLVED]
Posted: Fri Jun 27, 2008 1:16 pm
by Crunch
Hi,
Updating to 0.94.1
In old 0.94 I had used the topic….
'Can tracking IDs be shortened?'
viewtopic.php?t=341
to produce the ticket ID format of
27Jun08:534
Code in file submit_ticket.php
Code: Select all
/* Generate tracking ID */
/*
$useChars='AEUYBDGHJLMNPQRSTVWXZ123456789';
$trackingID = $useChars{mt_rand(0,29)};
for($i=1;$i<18;$i++)
*/
{
/* $trackingID .= $useChars{mt_rand(0,29)};*/
$trackingID= $trackingID .= date('dMy:B');
}
$trackingURL=$hesk_settings['hesk_url'].'/ticket.php?track='.$trackingID;
/* Attachments */
Applying this mod to 0.94.1 results in the following...
Ticket created and attachment uploads OK.
On viewing the ticket I get the ticket open OK.
Click on the image attachment link within the ticket and I get the error “HelpDesk Request ID not found”.
If I use the default settings in the submit_ticket.php file all seems to work well.
I am assuming things changed in how to handle attachments and that the attachment is not getting the same number as the ticket. I did have to change the ID field in my database tfrom 10 to 18 as mentioned in 'topic 341' is there a place in attachments I need to do that too?
This ticket ID has been great for us. It gives us the date and then a number behind the date to show what order during th day the ticket arrived.
Thanks
Edit
If you don't want to read the whole post here is the solution Klemen supplied in the end
You can try forcing case when comparing strings (with strtoupper or strtolower), for example in download_attachment try changing Code:
if ($file['ticket_id'] != $tic_id)
to Code:
if (strtoupper($file['ticket_id']) != strtoupper($tic_id))
and see if that helps.
Posted: Fri Jun 27, 2008 5:08 pm
by Klemen
This code:
Code: Select all
$trackingID= $trackingID .= date('dMy:B');
should be
Try changing this and see if it works. Old attachments probably won't work (because of wrong data in th database), see if new posts with attachments work.
Posted: Fri Jun 27, 2008 5:42 pm
by Crunch
Klemen,
Changed code.
Uploads in this rebuild are all new, I have not moved any 'old' posts to new database. With original code I can upload/view ticket/view attachment OK.
This works...
Code: Select all
/* Generate tracking ID */
$useChars='AEUYBDGHJLMNPQRSTVWXZ123456789';
$trackingID = $useChars{mt_rand(0,29)};
for($i=1;$i<10;$i++)
{
$trackingID .= $useChars{mt_rand(0,29)};
}
$trackingURL=$hesk_settings['hesk_url'].'/ticket.php?track='.$trackingID;
/* Attachments */
Change code as below and I can upload/view ticket/ NOT view attachment....
Code: Select all
/* Generate tracking ID */
/* $useChars='AEUYBDGHJLMNPQRSTVWXZ123456789';
$trackingID = $useChars{mt_rand(0,29)};
for($i=1;$i<18;$i++) */
{
/* $trackingID .= $useChars{mt_rand(0,29)}; */
$trackingID .= date('dMy:B');
}
$trackingURL=$hesk_settings['hesk_url'].'/ticket.php?track='.$trackingID;
/* Attachments */
Thanks for taking the time to look.
Posted: Fri Jun 27, 2008 6:50 pm
by Klemen
How about you completely delete
Code: Select all
$useChars='AEUYBDGHJLMNPQRSTVWXZ123456789';
$trackingID = $useChars{mt_rand(0,29)};
for($i=1;$i<10;$i++)
{
$trackingID .= $useChars{mt_rand(0,29)};
}
and just try
Posted: Fri Jun 27, 2008 7:44 pm
by Crunch
No Luck.
the image link in the ticket is trying to call
...... /.../download_attachment.php?att_id=12&track=27JUN08:862
Posted: Fri Jun 27, 2008 8:06 pm
by Klemen
Ah, try replacing : with _ in the date format (or remove the : ).
Posted: Fri Jun 27, 2008 8:42 pm
by Crunch
Ok I think I found something... and you may know how to correct it.
I was looking in the database and noticed the format of my ID's was the same as the random ones, except I had 'Jun' so there are lowercase letters in the ID. So I took out the 'M' in $trackingID .= date('d
My:B');
It worked.
So either I have to not use anything that will generate lower case letters or you can tell me where to change things so lowercase letters are allowed. I would love to keep the month in there as a word if possible. Of course I could be up the wrong tree and it has nothing to do with Lowercase
Edit
I found $trackingID .= date('d_m_y:B'); worked and a number of other combinations. but not 'M'
My problem is we have admins and users who because of USA having a different time structure to the rest of the world…..( don't get me started with measurements etc) people have to work out if 2/4/2008 is February 4th or April 2nd. So 8 Jun 08 :454 format gave me the date as a reference and the number covers if we get more than one ticket a day.
Thanks
Posted: Mon Jun 30, 2008 12:39 pm
by Crunch
Had a play over the weekend but could not get the ID to accept 'M'
I tried adding lowercase to the allowed letters numbers in a couple of files but no luck.
Klemen, is it possible to have the month as a word or do I need to just go ahead and use numbers in the form of 'dmy:B'
Thanks
Posted: Thu Jul 03, 2008 5:23 pm
by Klemen
You should be able to use any of the following settings to format the date:
http://php.net/date
Posted: Thu Jul 03, 2008 7:46 pm
by DC
I whipped up some code to make the date in the format I wanted it to output ...
This trick changes only the output you see, the DB still uses what it needs ....
The other way did not work for me you can try this if you like but back up your code...
I explain in detail how I modified the code as I too don't like MYSQL farmated dates :-).
Visit here and scroll down till you seee my name ...
viewtopic.php?t=1471
DC
Posted: Mon Jul 07, 2008 7:44 pm
by Crunch
Klemen,
I have spent days on this trying new installs to get it to work like the old 0.94
Currently with0.94.1 we can use
$trackingID= $trackingID .= date('dMy:B');
to create a ticket OK.
I understand that conforms to what you indicate in your last post. That link is to the page I got the codes from to set the dates.
That way we have ticket id's that are in the format 07Jul08:659 This is good as the committee members and person sending see the ticket number incorporates a date, It just makes it easy.
I can use $trackingID= $trackingID .= date('dmy:B'); and it works and it finds the attachment, but with 'M' the ticket is found but the attached image to that ticket causes an error that it cannot be found.
Thanks again. To clarify I can create tickets, I can retrieve tickets. But I cannot get the images attached to the ticket to show if I use ‘M’.
Could this be a server issue at my host having a problem with using ‘M’?
Crunch
Thanks for option DC, I am not sure if that will cover the effect I want.
Posted: Mon Jul 07, 2008 8:54 pm
by DC
No problem I figured in case you did not like the output you may like to have a mod for it, its just for the output shown to you and the visitor ...
I didnt think it would be used for your exact purpose just thoght if you or anyone needed or wanted it here it is ... as some have asked.
DC
Posted: Fri Jul 11, 2008 3:48 pm
by Crunch
Still been looking at this for days now..
I did notice this...
In the database under hesk_tickets etc the field is 11Jul08:688
The ticket created on some pages is being called and displayed as 11JUL08:688
In the admin area
The ticket number is displayed as 11Jul08:688 and clicking it will open the ticket. The ticket then opens with the ticket called 11JUL08:688
When you mouse over the link for the image attached it says it is going to look for 11JUL08:688
help08/download_attachment.php?att_id=7&track=11JUL08:688
So I am assuming UL is different from ul and so it reports an error the ticket can't be found.
The email recieved says
Your tracking ID: 11Jul08:688
You can view the status of your ticket here:
http :// w w w.*******.com/help08/ticket.php?track=11Jul08:688
but open the link and it is called 11JUL08:688
Any ides?
Posted: Fri Jul 11, 2008 8:23 pm
by Klemen
You can try forcing case when comparing strings (with strtoupper or strtolower), for example in download_attachment try changing
Code: Select all
if ($file['ticket_id'] != $tic_id)
to
Code: Select all
if (strtoupper($file['ticket_id']) != strtoupper($tic_id))
and see if that helps.
Posted: Fri Jul 11, 2008 11:31 pm
by Crunch
Yes yes yes.
That seems to have it....
Thanks, I had sent you a donation before I found you had posted a reply to my last post. Not sure if I had found this post first if I would have sent more $$$ or less
Thanks and have one on me. I know I will be having a beer this evening. I was about to 'spit the dummy' on this one.
Thanks
Crunch