Sort tickets by Status

Helpdesk for my helpdesk software

Moderator: mkoch227

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

Sort tickets by Status

Post by steve »

When sorting ticket, they are sorted numerically.

How can we sort the statuses by their name?

Here is an example

Status 1 = Open
Status 2 = Closed
Status 3 = Monitor

So if i sort by status, they will list as open, closed, monitor or the other way around which obviously is not alphabetical.
-Steve
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Sort tickets by Status

Post by Klemen »

Since the status names aren't in the database but numbers representing statuses, you would need a custom ORDER BY CASE query. Something like

Code: Select all

ORDER BY CASE status
                 WHEN '3' THEN 1
                 WHEN '4' THEN 2
                 WHEN '1' THEN 3
                 WHEN '0' THEN 4
                 WHEN '2' THEN 5
END
This would sort by status 3, 4, 1, 0 and last status 2.

Of course, you will need to modify this to fit your needs/exact status values and names.
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: Sort tickets by Status

Post by steve »

Thanks you!

Where am I to put this?
-Steve
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: Sort tickets by Status

Post by steve »

Where does this need to be placed?
-Steve
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Sort tickets by Status

Post by Klemen »

The order by code is generated inside inc/prepare_ticket_search.inc.php, you will need to do some tweaking to fit the required order by correctly. The exact code is up to you I'm afraid as it's not officially supported.
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
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

Re: Sort tickets by Status

Post by deserteagle369 »

The status and priority value are not stored in the table, made it difficult to manage it.
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: Sort tickets by Status

Post by Klemen »

Of course they are, just not as words (because these change with translations), but as digits representing them.

If you look inside "inc/print_tickets.inc.php" you will find these matching values:

Statuses:

Code: Select all

0 => 'NEW'
1 => 'WAITING REPLY'
2 => 'REPLIED'
3 => 'RESOLVED (CLOSED)'
4 => 'IN PROGRESS'
5 => 'ON HOLD'
Priority:

Code: Select all

0 => 'CRITICAL'
1 => 'HIGH'
2 => 'MEDIUM'
3 => 'LOW'
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: Sort tickets by Status

Post by steve »

Unfortunately, I was never able to make this work.
-Steve
Post Reply