Adding a new field in admin_main.php

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
elitedreamr
Posts: 3
Joined: Sun Sep 09, 2007 6:59 pm

Adding a new field in admin_main.php

Post by elitedreamr »

Script URL:
Version of script:
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:

Is it possible to add a new field on admin_main.php (next to the customer's name) that would list the name of the tech/staff member who is assisting on the ticket (if multiple staff members are, then the most recent would do)? I know it has to save that information somewhere in the database because it lists it in the ticket as the customer is assisted, but I am not sure how to go about doing it or if it would be more trouble than it's worth.



Thanks in advance!
rbbigdog
Posts: 19
Joined: Fri Aug 24, 2007 1:36 am

Post by rbbigdog »

Hello -

The problem is that there is not a listing for individual supporters in hesk. Some people, who use hesk, assign a category for each supporter (there are some good posts on that subject here). If you do it that way, than there is category query button already built in.

You could add another column to the main table if you want and have it show your categories (staff), but since most supporters don't see anything but their category tickets, having an extra column could be considered a little bit of a waste for most of the staff (except for the Admin who can see all tickets)

To make that change, you would add some code in your "print_tickets.inc.php" file. I think you would need to add information in 3 areas.....Here's an example (using my hesk setup)...the bolded areas is what I added:

<table border="0" width="750" cellspacing="1" cellpadding="3" class="white">
<tr>
<td class="admin_white">&nbsp;</td>
<td class="admin_white"><a href="show_tickets.php?<?php echo $query; ?>trackid"><?php echo $hesklang['trackID']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>lastchange"><?php echo $hesklang['last_update']; ?></a></td>
<td class="admin_white"><a href="show_tickets.php?<?php echo $query; ?>name"><?php echo $hesklang['name']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>category">Category</a></td>
<td class="admin_white"><a href="show_tickets.php?<?php echo $query; ?>subject"><?php echo $hesklang['subject']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>status"><?php echo $hesklang['status']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>lastreplier"><?php echo $hesklang['last_replier']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>priority"><?php echo $hesklang['priority']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>archive"><?php echo $hesklang['archived']; ?></a></td>
</tr>

<?php
while ($ticket=hesk_dbFetchAssoc($result))
{
if ($i) {$color="admin_gray"; $i=0;}
else {$color="admin_white"; $i=1;}

switch ($ticket['status']) {
case 0:
$ticket['status']='<font class="open">'.$hesklang['open'].'</font>';
break;
case 1:
$ticket['status']='<font class="waitingreply">'.$hesklang['wait_reply'].'</font>';
break;
case 2:
$ticket['status']='<font class="replied">'.$hesklang['replied'].'</font>';
break;
default:
$ticket['status']='<font class="resolved">'.$hesklang['closed'].'</font>';
}

switch ($ticket['priority']) {
case 1:
$ticket['priority']='<font class="important">'.$hesklang['high'].'</font>';
break;
case 2:
$ticket['priority']='<font class="medium">'.$hesklang['medium'].'</font>';
break;
default:
$ticket['priority']=$hesklang['low'];
}

switch ($ticket['category']) {
case 1:
$ticket['category']='<font class="important">Computer</font>';
break;
case 2:
$ticket['category']='<font class="medium">Facilities</font>';
break;
default:
$ticket['category']=Telephone;
}


$ticket['lastchange']=hesk_formatDate($ticket['lastchange']);

if ($ticket['lastreplier']=='1') {$ticket['lastreplier']=$hesklang['staff'];}
else {$ticket['lastreplier']=$hesklang['customer'];}

if ($ticket['archive']) {$ticket['archive']=$hesklang['yes'];}
else {$ticket['archive']=$hesklang['no'];}

echo <<<EOC
<tr>
<td class="$color" align="center"><input type="checkbox" name="id[]" value="$ticket[id]"></td>
<td class="$color"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[trackid]</a></td>
<td class="$color" align="center">$ticket[lastchange]</td>
<td class="$color">$ticket[name]</td>
<td class="$color" align="center">$ticket[category]</td>
<td class="$color"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[subject]</a></td>
<td class="$color" align="center">$ticket[status]</td>
<td class="$color" align="center">$ticket[lastreplier]</td>
<td class="$color" align="center">$ticket[priority]</td>
<td class="$color" align="center">$ticket[archive]</td>
</tr>

Hope this helps a little (remember to save a copy of your files before you make changes to them).

RB
WebsiteManagers
Posts: 23
Joined: Fri Jun 24, 2005 8:19 pm

Post by WebsiteManagers »

That was a great help. However, for those who periodically change categories, they will have to remember to also update the print_tickets.inc.php file any time there is a change.

There must be a way to put it all into an array that reads the categories in the database and updates the switch ($ticket['category']) section automatically.

I also noticed that when sorting the categories, they are grouped, but since they are referenced by number, are sorted numerically, not alphabetically. I realize this is probably only an issue on the Admin side. Grouping helps though, especially when dealing with multiple pages of tickets in many categories.

One question came to mind when creating the switch case section. If someone deletes a category, its ID is removed from the database leaving a gap in the number sequence. Does each case have to match the ID in the database? Example: case 10 matching ID 10?

Jim
[url=http://www.websitemanagers.net]Website Managers[/url]
Website Hosting and Development Since 1998
Post Reply