PDA

View Full Version : Show customer phone in staff index view


wcwoodson
01-15-2008, 11:03 PM
I would like to be able to see and sort the customers phone number (perhaps instead of priority if adding a whole new column is too much work).

I have found the relevant sections in the tickets.inc.php file. I'm just not sure how to grab/reference to the phone number information in the database (if possible). Any help would be greatly appreciated.

The header row:

<tr>
<?if($canDelete || $canClose) {?>
<th width="8px">&nbsp;</th>
<?}?>
<th width="70" >
<a href="tickets.php?sort=ID&order=<?=$negorder?><?=$qstr?>" title="Sort By Ticket ID <?=$negorder?>">Ticket</a></th>
<th width="70">
<a href="tickets.php?sort=date&order=<?=$negorder?><?=$qstr?>" title="Sort By Date <?=$negorder?>">Date</a></th>
<th width="250">Subject</th>
<th width="110">
<a href="tickets.php?sort=dept&order=<?=$negorder?><?=$qstr?>" title="Sort By Category <?=$negorder?>">Department</a></th>
<th width="70">
<a href="tickets.php?sort=pri&order=<?=$negorder?><?=$qstr?>" title="Sort By Priority <?=$negorder?>">Priority</a></th>
<th width="150" >From</th>
</tr>

and then the table row:

<tr class="<?=$class?> " id="<?=$row['ticket_id']?>">
<?if($canDelete || $canClose) {?>
<td align="center" class="nohover">
<input type="checkbox" name="tids[]" value="<?=$row['ticket_id']?>" onClick="highLight(this.value,this.checked);">
</td>
<?}?>
<td align="center" title="<?=$row['email']?>" nowrap>
<a class="Icon <?=strtolower($row['source'])?>Ticket" title="<?=$row['source']?> Ticket: <?=$row['email']?>"
href="tickets.php?id=<?=$row['ticket_id']?>"><?=$row['ticketID']?></a></td>
<td align="center" nowrap><?=Format::db_date($row['created'])?></td>
<td><a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?>
href="tickets.php?id=<?=$row['ticket_id']?>"><?=Format::truncate($row['subject'],32)?></a></td>
<td nowrap><?=$row['dept_name']?></td>
<td class="nohover" align="center" style="background-color:<?=$row['priority_color']?>;"><?=$row['priority_desc']?></td>
<td><?=Format::truncate($row['name'],32)?></td>
</tr>

4ice
01-16-2008, 01:30 PM
This is possible if you want.

Do the following in ./include/staff/tickets.inc.php:

Change
$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name');
into
$sortOptions=array('date'=>'ticket.created','ID'=>'ticketID','pri'=>'priority_urgency','dept'=>'dept_name','pho'=>'phone');
Change
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,pri.*';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
into
$qselect = 'SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.staff_id,subject,name,email,dept_name '.
',status,source,isoverdue,ticket.created,ticket.ph one,pri.*';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
Change
<th width="70">
<a href="tickets.php?sort=pri&order=<?=$negorder?><?=$qstr?>" title="Sort By Priority <?=$negorder?>">Priority</a></th>
into
<th width="70">
<a href="tickets.php?sort=pho&order=<?=$negorder?><?=$qstr?>" title="Sort By Phone <?=$negorder?>">Phone</a></th>
and change
<td class="nohover" align="center" style="background-color:<?=$row['priority_color']?>;"><?=$row['priority_desc']?></td>
into
<td class="nohover" align="center"><?=$row['phone']?></td>

Off course it's also possible to add another row if you want. Try to adjust the code as you see fit.

wcwoodson
01-16-2008, 09:02 PM
Worked perfectly. I went ahead and added a new column. In order to save myself headaches I didn't change the overall table size. I just shrunk some columns to get the space I needed to add some columns.

Thanks for the help. Bravo!