Page 1 of 1

Group by Owner display

Posted: Fri Sep 07, 2012 5:05 pm
by smegnl
Script URL: internal
Version of script: 2.4 RC
Hosting company: internal
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: Group Owner

Write your message below:
When using Group by Owner, is there a way to have the logged in owners tickets be the top group below the unassigned? So if Steve logs in, his tickets are the top group. If Ted logs in, then Ted's tickets are the top group and not have to scroll down the page to see his tickets. I dont care if "unassigned" are the top most group.

Re: Group by Owner display

Posted: Fri Sep 07, 2012 7:31 pm
by Klemen
Good idea!

Now, I haven't had time to test this thoroughly, but it seems to work just fine:

1. open file "inc/prepare_ticket_search.inc.php"

2. find this code

Code: Select all

    if ($group == 'priority' && isset($_GET['sort']) && $_GET['sort'] == 'priority')
    {
		// No need to group by priority if we are already sorting by priority
    }
3. just BELOW that code paste

Code: Select all

    elseif ($group == 'owner')
    {
		$sql .= " CASE WHEN `owner` = '".hesk_dbEscape($_SESSION['id'])."' THEN 1 ELSE 0 END DESC, ";
    }
4. Save, upload and test.

Re: Group by Owner display

Posted: Fri Sep 07, 2012 8:29 pm
by smegnl
Close....
It did group the owner at the top, but all the other tickets not owned by him were scattered below. The unassigned or owned by other people were not grouped together. Made it hard to find unassigned tickets.Image

Re: Group by Owner display

Posted: Fri Sep 07, 2012 9:00 pm
by Klemen
How about

Code: Select all

    elseif ($group == 'owner')
    {
		$sql .= " CASE WHEN `owner` = '".hesk_dbEscape($_SESSION['id'])."' THEN 1 ELSE 0 END DESC, `owner` ASC, ";
    }

Re: Group by Owner display

Posted: Sat Sep 08, 2012 12:27 am
by smegnl
With the two logins I had to test with look good. This will be the icing on the cake!!!