B) Search for the following code: (around line 400)
<a href="tickets.php?sort=pri&order=<?=$negorder?><?=$qstr?>" title="Sort By Priority <?=$negorder?>">Priority</a></th>
<th width="180" >From</th>
</tr>
<?
Below it add:
function printTree($child_ticket_id,$counter)
{
$sqlchild= "SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,email,dept_name ,ticket.status,ticket.source,isoverdue,isanswered,ticket.created,pri.* ,count(attach.attach_id) as attachments ,count(attach.attach_id) as attachments, IF(ticket.reopened is NULL,ticket.created,ticket.reopened) as effective_date 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()
LEFT JOIN ".TICKET_ATTACHMENT_TABLE." attach
ON ticket.ticket_id=attach.ticket_id
WHERE ticket.ticketID=".$child_ticket_id;
$childResult= db_query($sqlchild);
$ticketChild= db_fetch_row($childResult);
$tag1=$ticketChild?'assigned':'openticket';
$flag1=null;
if($ticketChild)
$flag1='locked';
elseif($ticketChild)
$flag1='assigned';
elseif($ticketChild)
$flag1='overdue';
$string='';
if($flag1) { $string=' class="Icon'.$flag1.'Ticket" title="'.ucfirst($flag1).' Ticket"' ;}
$string.=' href="tickets.php?id='.$ticketChild.'">'.$ticketChild;
if($ticketChild) $string.='<span class=\'Icon file\'> </span>';
$colArray='<input type="checkbox" name="tids" value="'.$ticketChild.'" onClick="highLight(this.value,this.checked);">';
$colArray='<br/> <a class="Icon '.strtolower($ticketChild).' Ticket" title="'.$ticketChild.' Ticket: '.$ticketChild.'"
href="tickets.php?id='.$ticketChild.'">--'.$ticketChild.'</a>';
$colArray='<br>'.Format:($ticketChild);
$colArray=' <br><a '. $string.' </a> ';
$colArray='<br/>'.Format:($ticketChild,30);
$colArray='<br/>'.$ticketChild;
$colArray='<br/>'.Format:($ticketChild,22,strpos($row,'@'));
return $colArray;
}
C) Search for the following code:
$tag=$row?'assigned':'openticket';
$flag=null;
Replace it with:
$col1="";
$col2="";
$col3="";
$col4="";
$col5="";
$col6="";
$col7="";
$showchild=false;
$tid=$row;
$sqlchild= "SELECT child_ticket_id ,parent_ticket_id FROM ".LINK_TABLE. " WHERE parent_ticket_id=".$tid;
$childResult= db_query($sqlchild);
$childResult1= db_query($sqlchild);
$childCount = 0;
while($resItems = db_fetch_row($childResult1))
{
$resultarray=printTree($resItems,$childCount);
if( empty($col1)) $col1= $resultarray; else $col1.=$resultarray;
if( empty($col2)) $col2= $resultarray; else $col2.=$resultarray;
if( empty($col3)) $col3= $resultarray; else $col3.=$resultarray;
if( empty($col4)) $col4= $resultarray; else $col4.=$resultarray;
if( empty($col5)) $col5= $resultarray; else $col5.=$resultarray;
if( empty($col6)) $col6= $resultarray; else $col6.=$resultarray;
if( empty($col7)) $col7= $resultarray; else $col7.=$resultarray;
$childCount++;
$showchild=false;
}
if($childCount==0) $showchild=true;
$tag=$row?'assigned':'openticket';
$flag=null;
D) Search for the following code:
<input type="checkbox" name="tids" value="<?=$row?>" onClick="highLight(this.value,this.checked);">
Below it add:
<?php if($showchild==false) echo $col1; ?>
F) Search for the following code: (around 433 to 435)
href="tickets.php?id=<?=$row?>"><?=$tid?></a></td>
<td align="center" nowrap><?=Format:($row)?></td>
<td><a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?>
Replace it with:
href="tickets.php?id=<?=$row?>"><?=$tid?></a>
<?php if($showchild==false){echo $col2;}?>
</td>
<td align="center" nowrap>
<?=Format:($row)?>
<?php if($showchild==false){echo $col3;}?>
</td>
<td>
<a <?if($flag) { ?> class="Icon <?=$flag?>Ticket" title="<?=ucfirst($flag)?> Ticket" <?}?>
G) Find the following code: (around lines 437 to 440)
<?=$row?"<span class='Icon file'> </span>":''?></td>
<td nowrap><?=Format:($row,30)?></td>
<td class="nohover" align="center" style="background-color:<?=$row?>;"><?=$row?></td>
<td nowrap><?=Format:($row,22,strpos($row,'@'))?> </td>
Replace it with the following:
<?=$row?"<span class='Icon file'> </span>":''?>
<?php if($showchild==false){echo $col4;}?>
</td>
<td nowrap><?=Format:($row,30)?>
<?php if($showchild==false){echo $col5; ?> <?php } ?>
</td>
<td class="nohover" align="center" style="background-color:<?=$row?>;"><?=$row?>
<?php if($showchild==false){ echo $col6; ?><?php } ?>
</td>
<td nowrap><?=Format:($row,22,strpos($row,'@'))?>
<?php if($showchild==false){echo $col7;?> <?php } ?>
</td>
9. Edit /include/staff/newticket.inc.php
A) Search for the following code: (approx. line 3)
$info=($_POST && $errors)?Format:($_POST)(); //on error...use the post data
Below add the following:
//Ticket categorization code
//get ticket types
$sql = "SELECT ticket_typeid,ticket_type FROM ".TICKET_TYPE_TABLE." WHERE status=1";
$res = db_query($sql);
B) Directly below the code just added there should be the following: ?>
Copy the following code directly below that:
<script>
function getXMLHTTP() { //fuction to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e) {
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}
return xmlhttp;
}
function getMaincategory(strURL) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById('maincategorydiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function getSubcategory(ticket,maincategory) {
var strURL="ajax.php?api=autoaddsubcat&f=getsubcategory&ticket="+ticket+"&maincategory="+maincategory;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById('hiddenfield').value= document.getElementById('main_category').value;
document.getElementById('subcategorydiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function getCategoryDetail(ticket,maincategory,subcategory) {
var strURL="ajax.php?api=autoaddsubcat&f=getcategorydetail&ticket="+ticket+"&maincategory="+maincategory+"&subcategory="+subcategory;
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById('hiddenfieldsub').value= document.getElementById('sub_category').value;
document.getElementById('categorydetailsdiv').innerHTML=req.responseText;
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", strURL, true);
req.send(null);
}
}
function getvalue(){
document.getElementById('hndcatid').value= document.getElementById('selcategorydetails').value;
}
</script>
***Note**** There is more. The last post will have the needed additional files and screencaps