[MOD] Show ticket's custom field in admin page

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

[MOD] Show ticket's custom field in admin page

Post by m4dbra1n »

/*************************************
Title:
Version:
Author:
Demo:
Download:
Website:

Short description:

Hi,

I wanna know if it's possible to show a ticket's custom field in the admin page, make it clickable and give the admin or other user the option to sort by it.

I need this to show model and IMEI for our internal assistance

Thanks in advance ;)
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

Post by m4dbra1n »

Pleeeeease! :D
masterzonk
Posts: 2
Joined: Wed Apr 28, 2010 3:53 pm

Post by masterzonk »

me too!
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

Post by m4dbra1n »

I came back here after some months to ask once again if it's possible.

Do I have to follow hints from similar threads?

Thanks in advance :wink:
AKNL
Posts: 15
Joined: Mon Aug 08, 2011 9:48 am

Re: [MOD] Show ticket's custom field in admin page

Post by AKNL »

easy!
SS113
Posts: 27
Joined: Mon Aug 15, 2011 1:27 pm

Re: [MOD] Show ticket's custom field in admin page

Post by SS113 »

I managed to do that pretty easily 8)

open up inc/ticket_list.inc.php

This file handles all the rows of tickets in your admin_main.php (ie Admin home page)

now, here is where we can add/move columns around to fit our needs.

Since I'm using the system as more of a "check in" system, I need it to show things like customer name, phone, what they brought and so on.

Starting from the top of ticket_list.inc.php between lines 185 and 200 we have our headings for our columns.

each column is enclosed by <th> code code </th> tags. Based on columns already there we can construct our custom field. Before we can start, we need to find out what "number" is this field. For example, go down the custom fields in your settings and see what field you want to add. Count down from the top what number that field is and that'll be the starting point.

So lets say you have these custom fields:

Address
City
State
Zip
Phone

If you want to show City, then that'll be named "custom2". Zip will be "custom4" and so on.

Now that we know what "custom(number)" our field is called we can go back to editing ticket_list.inc.php

find the position you want to place your field in and make a new <th> code </th>

so it'll look something like:

Code: Select all

<th class="admin_white" style="text-align:left; white-space:nowrap;"><a href="<?php echo $href . '?' . $query; ?>custom7"><?php echo $hesklang['phone']; ?></a></th>
since in the above code Hesk will not know what $hesklang['phone'] is, lets define it. Open up language/en/text.php and add

Code: Select all

$hesklang['phone']='Phone Number'; 


save and close it then go back to ticket_list.inc.php

Around line 265 you should see some more <td> tags. Those are what the system will use to show each row and the information for that particular ticket. This is where we can also make it clickable so when we click our custom field, we can go in and see that ticket.

So the MOST important thing remember here is that the same order needs to be kept with the above editing when we added the column headings or they will not align right.

Do the moving and when done, add your custom field the same way but it will look like:

Code: Select all

<td class="$color">$owner<a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[custom7]</a></td>
the good thing is that you can add multiple custom fields to show more data.. for example you can do:

Code: Select all

<td class="$color">$owner<a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[custom7] $ticket[custom8]</a></td>
The above will bundle custom7 and custom 8 into one separated by a space.

That's about it. upload the modified files to your hesk and try it out.

I hope I was being as clear as possible!

:mrgreen:
Post Reply