Page 1 of 1
change default ticket list sort to create date
Posted: Mon Mar 04, 2013 7:30 am
by deserteagle369
Script URL:
Version of script: 2.41
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
Write your message below:
In home page for admin:
how to make the ticket list by "create date" by default? only "Last Updated" option no "dt" option.
Re: change default ticket list sort to create date
Posted: Tue Mar 05, 2013 3:31 pm
by Klemen
In inc/prepare_ticket_search.inc.php try changing
Code: Select all
$sql .= ' `t1`.`status` ';
$sort = 'status';
to
Code: Select all
$sql .= ' `t1`.`dt` ';
$sort = 'dt';
This should sort tickets by date by default, but the "date" sill will not show in the list. To show it in the list, you would have to add another column in the "inc/ticket_list.inc.php" file.
Re: change default ticket list sort to create date
Posted: Wed Mar 06, 2013 2:30 am
by deserteagle369
Thanks Klemen, I already added the 'dt' column.
And how to change the order from 'ASC' to 'DSC'?
Re: change default ticket list sort to create date
Posted: Wed Mar 06, 2013 8:55 pm
by Klemen
In inc/prepare_ticket_search.inc.php you will find
Re: change default ticket list sort to create date
Posted: Mon Jun 24, 2013 10:53 am
by akwil
Hi Klemen, deserteagle369,
Thank you for this post. It really solved my problem!
My additional question to it is:
In inc/prepare_ticket_search.inc.php you will find $sql .= ' ASC ';
I have change it to DESC but my concern is -> if I also should modify the 0 - 1 part?
I replaced DESC with ASC and ASC with DESC to work both ways...
For me it looks like this... could you please confirm if it is correct?
/* Ascending or Descending? */
if (isset($_GET['asc']) && $_GET['asc']==0)
{
$sql .= ' ASC ';
$asc = 0;
$asc_rev = 1;
$sort_possible[$sort] = 1;
}
else
{
$sql .= ' DESC ';
$asc = 1;
$asc_rev = 0;
if (!isset($_GET['asc']))
{
$is_default = 1;
}
$sort_possible[$sort] = 0;
}
Re: change default ticket list sort to create date
Posted: Mon Jun 24, 2013 12:23 pm
by Klemen
If you want to change the default setting, just change the one thing that was mentioned.
However, note that this is only if you wish to have a global default different. You can simply achieve a "per user" setting without any code modifications like this:
1. in admin panel create a list of tickets with options that fit your needs
2. under "Options" select "Make this my default view" and click "Show tickets" button
This will save the view as the default one for your username.
Re: change default ticket list sort to create date
Posted: Mon Jun 24, 2013 12:48 pm
by akwil
Thank you Klemen for you quick answer.
1) When i am changing the mentioned thing -> from ASC to DESC -> yes it shows good result but when you press on "Updated" to sort it (ASC or DESC) doesnt work. After i changed it in both places it started to work fine... like this:
if (isset($_GET['asc']) && $_GET['asc']==0)
{
$sql .= ' ASC '; -> originally was DESC
....
else
{
$sql .= ' DESC '; -> originally was ASC
2) I know that I can change it on user but when you press make this view as default it shows you the expanded view (of all options) all the time. Should be collapsed... but it is not...
I asked about the 0-1 becuase i thought that is also important to change...
Thank you
Artur
Re: change default ticket list sort to create date
Posted: Mon Jun 24, 2013 6:52 pm
by Klemen
You can try it like this:
1. under options select "Make this my default view"
2. click "Hide options"
3. click "Show tickets"
It will still be saves as defaults, but with more options hidden.
Re: change default ticket list sort to create date
Posted: Mon Jun 24, 2013 8:01 pm
by akwil
Yep you are right it works now perfect!
Thank you for this tip!
If we are talking about views...
One question regarding it. I need to add more space for subject...
I was wondering if it is possible to change the WIDTH of the tickets table.
I mean to make more space for "subject" (it wrap long text).
If i change the width size it will affect all sub-sites?
Where i should change the width to affect only "open tickets" table? in admin_main.php?
Re: change default ticket list sort to create date
Posted: Tue Jun 25, 2013 8:40 am
by Klemen
You can do this to just modify the admin pages:
1. open inc/header.inc.php
2. find
Code: Select all
<?php
include(HESK_PATH . 'header.txt');
?>
<div align="center">
<table border="0" cellspacing="0" cellpadding="5" class="enclosing">
3. change it to
Code: Select all
<?php
include(HESK_PATH . 'header.txt');
$cls = 'enclosing';
if (strpos($_SERVER['SCRIPT_FILENAME'],'/admin/') !== false)
{
$cls = 'enclosing" style="width:970px;';
}
?>
<div align="center">
<table border="0" cellspacing="0" cellpadding="5" class="<?php echo $cls; ?>">
Re: change default ticket list sort to create date
Posted: Tue Jun 25, 2013 1:25 pm
by akwil
Thank you Klemen for that!
It really helped me. The tickets are not beeing wraped now. Perfect.
If i need to extend the subject length i need to change it in mysql i think... varchar(70)
correct?
Greetings,
Artur