Help! ticket list needing hesk_users 'user' not 'id' #

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
SnortDorker
Posts: 11
Joined: Mon Jun 20, 2011 3:39 am

Help! ticket list needing hesk_users 'user' not 'id' #

Post by SnortDorker »

Script URL: ticket_list.inc.php
Version of script: 2.2
Hosting company: localhost\intranet
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution: owner, hesk_users, ticket_list, admin_main, customize ticket list results

Write your message below:

I changed ticket_list.inc.php so that the ticket list in admin_main would show the owner instead of lastreplier. Now it shows the hesk_users id #. Can someone help me get it to show the user field instead of the id field from hesk_users. I would keep plodding ahead and grinding away at this until I figured it out but I want to deploy the changes I have made before I start my summer vacation in 2 days and I currently have a headache. Have pity on a PHP noob? I am learning PHP though, honestly.
ettubrutus
Posts: 1
Joined: Wed Jun 22, 2011 7:03 pm

Re: Help! ticket list needing hesk_users 'user' not 'id' #

Post by ettubrutus »

around line 199 of inc/ticket_list.inc.php find


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

after that add this code:


//added category
$sql = 'SELECT * FROM `hesk_users` WHERE `id`='.$ticket['owner'].' LIMIT 1';
$newresult = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]:
$sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>
$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
$newcategory = hesk_dbFetchAssoc($newresult);
// done

I am assunming that you currently are displaying the user number with the following line of code:

<td class="$color">$ticket[owner]</td>

change that to:

<td class="$color">$newcategory['name']</td>

Hope this works for you. It did for me.
SnortDorker
Posts: 11
Joined: Mon Jun 20, 2011 3:39 am

Re: Help! ticket list needing hesk_users 'user' not 'id' #

Post by SnortDorker »

ettubrutus wrote:around line 199 of inc/ticket_list.inc.php find


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

after that add this code:


//added category
$sql = 'SELECT * FROM `hesk_users` WHERE `id`='.$ticket['owner'].' LIMIT 1';
$newresult = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]:
$sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>
$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
$newcategory = hesk_dbFetchAssoc($newresult);
// done

I am assunming that you currently are displaying the user number with the following line of code:

<td class="$color">$ticket[owner]</td>

change that to:

<td class="$color">$newcategory['name']</td>

Hope this works for you. It did for me.

Thanks it worked fine once I removed the single quotes from around name like so:
<td class="$color">$newcategory[name]</td>

Thanks for making the beginning of my vacation hassle free.
mqcarpenter
Posts: 11
Joined: Mon Mar 25, 2013 5:17 pm

Re: Help! ticket list needing hesk_users 'user' not 'id' #

Post by mqcarpenter »

FYI this was very helpful for me too. Thank you!
Post Reply