change the ticket overview columns @ home of the admin panel

Helpdesk for my helpdesk software

Moderator: mkoch227

dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

change the ticket overview columns @ home of the admin panel

Post 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.
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: change the ticket overview columns @ home of the admin p

Post 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

Code: Select all

$sort_possible = array(
Add

Code: Select all

'id'  => 1,
Where 1 = your desired default sort setting . asc(1)/desc(0)
-Steve
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post by dr_patso »

thanks man, I will probably get cracking on this today, will come back with my results!
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post 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"
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post 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"
steve
Posts: 147
Joined: Tue Mar 27, 2012 9:32 pm

Re: change the ticket overview columns @ home of the admin p

Post 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.
-Steve
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

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

Re: change the ticket overview columns @ home of the admin p

Post 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']]
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
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post 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

Code: Select all

[$ticket['category']]
at the end of both instances of

Code: Select all

$hesk_settings['categories']
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'];
}
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post 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]" />&nbsp;</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]&nbsp;</td>
		<td class="$color">$hesk_settings['categories'][$ticket[category]]</td>
		<td class="$color" style="text-align:center; white-space:nowrap;">$ticket[priority]&nbsp;</td>
		</tr>
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: change the ticket overview columns @ home of the admin p

Post by Klemen »

Remove quotes from variable names, you can't use single quotes within <<<EOC block.
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
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post 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]" />&nbsp;</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]&nbsp;</td>
		<td class="$color">$hesk_settings[categories]$ticket[category]</td>
		<td class="$color" style="text-align:center; white-space:nowrap;">$ticket[priority]&nbsp;</td>
		</tr>
Image
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: change the ticket overview columns @ home of the admin p

Post by Klemen »

It should be

Code: Select all

$hesk_settings[categories][$ticket[category]]
- just remove single quotes from the previous version you had.
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
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

Post 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

Image
dr_patso
Posts: 192
Joined: Tue May 15, 2012 3:23 am

Re: change the ticket overview columns @ home of the admin p

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

Image

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