change default ticket list sort to create date

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
deserteagle369
Posts: 94
Joined: Wed Feb 29, 2012 2:00 am

change default ticket list sort to create date

Post 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.
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: change default ticket list sort to create date

Post 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.
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: change default ticket list sort to create date

Post by deserteagle369 »

Thanks Klemen, I already added the 'dt' column.

And how to change the order from 'ASC' to 'DSC'?
Eagle
Life is a journey.
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: change default ticket list sort to create date

Post by Klemen »

In inc/prepare_ticket_search.inc.php you will find

Code: Select all

$sql .= ' ASC ';
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
akwil
Posts: 24
Joined: Fri May 24, 2013 10:00 am

Re: change default ticket list sort to create date

Post 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;
}
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: change default ticket list sort to create date

Post 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.
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
akwil
Posts: 24
Joined: Fri May 24, 2013 10:00 am

Re: change default ticket list sort to create date

Post 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
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: change default ticket list sort to create date

Post 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.
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
akwil
Posts: 24
Joined: Fri May 24, 2013 10:00 am

Re: change default ticket list sort to create date

Post 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?
Klemen
Site Admin
Posts: 10147
Joined: Fri Feb 11, 2005 4:04 pm

Re: change default ticket list sort to create date

Post 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; ?>">
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
akwil
Posts: 24
Joined: Fri May 24, 2013 10:00 am

Re: change default ticket list sort to create date

Post 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
Post Reply