Page 1 of 1
Default sorting by date (most recent) in admin_main.php
Posted: Fri Feb 26, 2010 3:08 pm
by m4dbra1n
/*************************************
Title:
Version:
Author:
Demo:
Download:
Website:
Short description:
Hi,
default sorting in admin_main.php is by status.
How can I change the default sorting to date by most recent? Or to another field?
Thanks in advance

Posted: Fri Feb 26, 2010 5:32 pm
by Klemen
In print_tickets.inc.php change
Valid values are: 'trackid','lastchange','name','subject','status','lastreplier','priority','category','dt' (for date of creating) or 'id'
Posted: Fri Feb 26, 2010 5:44 pm
by m4dbra1n
I've found it just some minute ago!
Thanks anyway Klemen

Posted: Tue Mar 02, 2010 5:45 pm
by m4dbra1n
Sorry Klemen, but it just doesn't work.
They are not sorted.
How can I fix it?
What have I to change here?
It goes OK if I click on the lastchange field title (ULTIMO AGGIORNAMENTO for me)
Code: Select all
/* Acceptable $sort values */
$sort_possible = array('trackid','lastchange','name','subject','status','priority','category','dt','id');
if (isset($_GET['sort']) && in_array($_GET['sort'],$sort_possible))
{
$sort = hesk_input($_GET['sort']);
$sql .= ' ORDER BY `'.hesk_dbEscape($sort).'` ';
}
else
{
$sql .= ' ORDER BY `status` ASC, `priority`';
$sort = 'dt'; <-- changed as you said to me
}
if (isset($_GET['asc']) && $_GET['asc']==0)
{
$sql .= ' DESC ';
$asc = 0;
$asc_rev = 1;
}
else
{
$sql .= ' ASC ';
$asc = 1;
$asc_rev = 0;
if (!isset($_GET['asc']))
{
$is_default = 1;
}
Posted: Tue Mar 02, 2010 7:38 pm
by Klemen
In this case you are trying to sort by last modified, so you should use 'lastchange' not 'dt' (dt sorts by date created).
Posted: Wed Mar 03, 2010 11:49 am
by m4dbra1n
In that way works like a charm!
Thanks man

Posted: Tue Apr 27, 2010 9:05 pm
by m4dbra1n
Hi everyone,
now that I'm using it in a hard way, I've found a bug regarding the sorting of the tickets.
Now I'm having approximately 70 tickets in 4 pages, showing 20 tickets per page.
Since I want them to be sorted by the most recent, if I click on the page, they magically don't mantain the sorting; if i came back to home they re-take the sorting as I want.
How can I make them remain sorted by the most recent? Maybe have I to change something in the print_tickets.inc.php?
Thanks in advance to everyone will help me

Posted: Thu Apr 29, 2010 9:29 am
by Klemen
There's a little bug when it comes to sorting tickets in version 2.1, that's what you're experiencing probably. The issue has been addressed in Hesk 2.2 which should be released in early May.
Posted: Tue May 18, 2010 4:20 pm
by m4dbra1n
FINALLY I'VE MADE IT!
Around line 120 I have made this:
Code: Select all
/* Acceptable $sort values */
$sort_possible = array('trackid','lastchange','name','subject','status','category','dt','id');
if (isset($_GET['sort']) && in_array($_GET['sort'],$sort_possible))
{
$sort = hesk_input($_GET['sort']);
$sql .= ' ORDER BY `'.hesk_dbEscape($sort).'` ';
}
else
{
$sql .= ' ORDER BY `lastchange` DESC, `name`';
$sort = 'lastchange';
}
if (isset($_GET['asc']) && $_GET['asc']==0)
{
$sql .= ' DESC ';
$asc = 0;
$asc_rev = 1;
}
//lines as comment to make sort work
/*else
{
$sql .= ' ASC ';
$asc = 1;
$asc_rev = 0;
if (!isset($_GET['asc']))
{
$is_default = 1;
}
}
*/
Hope this helps
