Page 1 of 2
change the ticket overview columns @ home of the admin panel
Posted: Tue May 15, 2012 9:33 pm
by dr_patso
Script URL:
Version of script: 2.3
Hosting company: hostgator
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: modify ticket overview columns, modify ticket table, change ticket overview
Write your message below:
Hello,
I have been digging through the code and cannot find out where the columns are being requested for the ticket overview...
Is it possible to modify the homepage for admins to display the category as a column, and then the Ticket Number instead of the tracking ID???? I am fairly confident to go through and modify some code.. I have accomplished several other things I think I will post here.
Re: change the ticket overview columns @ home of the admin p
Posted: Tue May 15, 2012 10:33 pm
by steve
To modify which columns are shown and to add new ones follow the steps outlined in this thread.
viewtopic.php?f=14&t=3036&p=15624&hilit ... ist#p15624
To list Ticket Number instead of Tracking ID
Open inc/ticket_list.inc.php
Change
Code: Select all
<td class="$color" style="text-align:left; white-space:nowrap;"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[trackid]</a></td>
To
Code: Select all
<td class="$color" style="text-align:left; white-space:nowrap;"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[id]</a></td>
Also change
Code: Select all
<th class="admin_white" style="text-align:left; white-space:nowrap;"><a href="<?php echo $href . '?' . $query . $sort_possible['trackid'] . '&sort='; ?>trackid"><?php echo $hesklang['trackID']; ?></a></th>
To
Code: Select all
<th class="admin_white" style="text-align:left; white-space:nowrap;"><a href="<?php echo $href . '?' . $query . $sort_possible['id'] . '&sort='; ?>trackid"><?php echo $hesklang['seqid']; ?></a></th>
Also to allow for sorting of the column
Open inc/prepare_ticket_search.inc.php
Under
Add
Where 1 = your desired default sort setting . asc(1)/desc(0)
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 4:42 pm
by dr_patso
thanks man, I will probably get cracking on this today, will come back with my results!
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 4:44 pm
by dr_patso
i may be able to figure this out from the code provided.. but what about one of the columns in the ticket list containing "category" instead of "last replier"
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 5:11 pm
by dr_patso
I did get the ticket number to show up now instead of tracking ID...
I also have category showing up, ofcourse its the category ID.... Would I have to do a table join to get the actual category name to show up? or is there something i should be using besides "category"
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 5:21 pm
by steve
That one is a little beyond me. Maybe Klemen can help you out with that.
I use categories as companies, so it is important to me which company a ticket is in.
I use the group by category (company) option the show tickets box on the admin_main.php, this group all tickets by category (company) which i prefer as I already have a fair bit of information in my admin ticket list.
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 5:27 pm
by dr_patso
cool, ya I appreciate your help Steve. I'm pretty sure I'd have to know how to do a table join in PHP.. as the category ID name is defined by an entirely separate table, the ticket table just knows it's category via a numeric value.
I know you can group by category, so you don't necessarily need it as a column.. I'd like to accomplish this though as it is not a request by me.
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 6:26 pm
by Klemen
You should be able to get the category name using $hesk_settings['categories'] array when printing tickets.
As you already know $ticket['category'] contains the ID, to get the name this should work:
Code: Select all
$hesk_settings['categories'][$ticket['category']]
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 7:35 pm
by dr_patso
Thanks Klemin,
This is how I acccomplished categories instead of last reply changing the ticket_list.inc.php
Code: Select all
<td class="$color">$ticket[category]</td>
So I added that line
at the end of both instances of
Here is the example where I found that and how it looks now, with no change to the categories column..
Code: Select all
/* List of categories */
$hesk_settings['categories'][$ticket['category']] = array();
$sql2 = 'SELECT `id`, `name` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'categories` WHERE ' . hesk_myCategories('id') . ' ORDER BY `cat_order` ASC';
$res2 = hesk_dbQuery($sql2);
while ($row=hesk_dbFetchAssoc($res2))
{
$hesk_settings['categories'][$ticket['category']][$row['id']] = $row['name'];
}
Re: change the ticket overview columns @ home of the admin p
Posted: Wed May 16, 2012 7:44 pm
by dr_patso
hm i also tried adding it here in the ticket_list.inc.php file but it broked it.
Code: Select all
$ticket['message'] = $first_line . substr(strip_tags($ticket['message']),0,200).'...';
echo <<<EOC
<tr title="$ticket[message]">
<td class="$color" style="text-align:left; white-space:nowrap;"><input type="checkbox" name="id[]" value="$ticket[id]" /> </td>
<td class="$color" style="text-align:left; white-space:nowrap;"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[id]</a></td>
<td class="$color">$ticket[lastchange]</td>
<td class="$color">$ticket[name]</td>
<td class="$color">$tagged$owner<a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[subject]</a></td>
<td class="$color">$ticket[status] </td>
<td class="$color">$hesk_settings['categories'][$ticket[category]]</td>
<td class="$color" style="text-align:center; white-space:nowrap;">$ticket[priority] </td>
</tr>
Re: change the ticket overview columns @ home of the admin p
Posted: Thu May 17, 2012 7:05 am
by Klemen
Remove quotes from variable names, you can't use single quotes within <<<EOC block.
Re: change the ticket overview columns @ home of the admin p
Posted: Thu May 17, 2012 4:43 pm
by dr_patso
oh whoops, still confused as to where I need to put this..
doing this to the ticket_list.inc.php prefixed the category ID with "array" (2nd to last <td class)
Code: Select all
echo <<<EOC
<tr title="$ticket[message]">
<td class="$color" style="text-align:left; white-space:nowrap;"><input type="checkbox" name="id[]" value="$ticket[id]" /> </td>
<td class="$color" style="text-align:left; white-space:nowrap;"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[id]</a></td>
<td class="$color">$ticket[lastchange]</td>
<td class="$color">$ticket[name]</td>
<td class="$color">$tagged$owner<a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[subject]</a></td>
<td class="$color">$ticket[status] </td>
<td class="$color">$hesk_settings[categories]$ticket[category]</td>
<td class="$color" style="text-align:center; white-space:nowrap;">$ticket[priority] </td>
</tr>

Re: change the ticket overview columns @ home of the admin p
Posted: Thu May 17, 2012 5:28 pm
by Klemen
It should be
Code: Select all
$hesk_settings[categories][$ticket[category]]
- just remove single quotes from the previous version you had.
Re: change the ticket overview columns @ home of the admin p
Posted: Thu May 17, 2012 5:40 pm
by dr_patso
that is what I have, it switched it from containing just the category ID to prefixing the category Id number with array
this is how it looks now
Code: Select all
<td class="$color">$hesk_settings[categories]$ticket[category]</td>
the category field populates like this

Re: change the ticket overview columns @ home of the admin p
Posted: Thu May 17, 2012 5:51 pm
by dr_patso
also, I tried the code exactly how you have it layed out
Code: Select all
<td class="$color">$hesk_settings[categories][$ticket[category]]</td>
that just put's brackets around the category ID.... so it seems $hesk_settings[categories] is just pulling "array" instead of the category name =(.. does it need another line of code to read category id and match it up with the category name?.. I know in the hesk_tickets table all it contains is the category ID,, to pump out the category name in a sql query I have to do a table join with hesk_categories...
This is how i get a table to display the category name instead of ID in mysql query.
Code: Select all
FROM hesk_tickets, hesk_categories
WHERE ( hesk_categories.id=hesk_tickets.category)