query($query);
$user_id = $adb->query_result($ticketresult,0,'assigned_user_id');
$user_query = "select user_name from users where id='".$user_id."'";
$user_result = $adb->query($user_query);
$user_name = $adb->query_result($user_result,0,'user_name');
global $app_strings;
global $app_list_strings;
global $mod_strings;
global $current_user;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
require_once($theme_path.'layout_utils.php');
$xtpl=new XTemplate ('modules/HelpDesk/TicketInfoView.html');
$xtpl->assign("MOD", $mod_strings);
$xtpl->assign("APP", $app_strings);
$xtpl->assign("THEME", $theme);
$xtpl->assign("IMAGE_PATH", $image_path);
$xtpl->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
$xtpl->assign("NAME", $adb->query_result($ticketresult,0,'title'));
$xtpl->assign("RETURN_MODULE", 'HelpDesk');
$xtpl->assign("ID", $adb->query_result($ticketresult,0,'id'));
$xtpl->assign("GROUPVALUE", $adb->query_result($ticketresult,0,'groupname'));
$xtpl->assign("CREATEDDATE", $adb->query_result($ticketresult,0,'date_created'));
$xtpl->assign("USERNAME", $user_name);
$xtpl->assign("EXPECTED_CLOSE_DATE", $adb->query_result($ticketresult,0,'estimate_finish_time'));
$parent_type = $adb->query_result($ticketresult,0,'parent_type');
$parent_id = $adb->query_result($ticketresult,0,'parent_id');
if($parent_type == 'Accounts')
{
$pt_type = "Account Name";
if(isset($parent_id) && $parent_id != '')
{
$pt_rst=$adb->query("select name from accounts where id='".$parent_id."'");
$xtpl->assign("ENTITYNAME", $adb->query_result($pt_rst,0,'name'));
}
}
elseif($parent_type == 'Opportunities')
{
$pt_type = "Opportunity Name";
if(isset($parent_id) && $parent_id != '')
{
$pt_rst=$adb->query("select name from opportunities where id='".$parent_id."'");
$xtpl->assign("ENTITYNAME", $adb->query_result($pt_rst,0,'name'));
}
}
elseif($parent_type == 'Products')
{
$pt_type = "Product Name";
if(isset($parent_id) && $parent_id != '')
{
$pt_rst=$adb->query("select productname from products where id='".$parent_id."'");
$xtpl->assign("ENTITYNAME", $adb->query_result($pt_rst,0,'productname'));
}
}
$xtpl->assign("ENTITY", $pt_type);
$last_name = $adb->query_result($ticketresult,0,'last_name');
if(isset($last_name) && $last_name != '')
{
$contactname = $adb->query_result($ticketresult,0,'first_name')." ".$adb->query_result($ticketresult,0,'last_name');
$xtpl->assign("CONTACTNAME", $contactname);
}
$xtpl->assign("PRIORITYOPTIONS", $adb->query_result($ticketresult,0,'priority'));
$xtpl->assign("STATUSOPTIONS", $adb->query_result($ticketresult,0,'status'));
$xtpl->assign("CATEGORYOPTIONS", $adb->query_result($ticketresult,0,'category'));
$xtpl->assign("SUBJECT", $adb->query_result($ticketresult,0,'title'));
$xtpl->assign("DESCRIPTION", nl2br($adb->query_result($ticketresult,0,'description')));
//Assigning Custom Field Values
require_once('include/CustomFieldUtil.php');
$custfld = CustomFieldDetailView($ticketid, "HelpDesk", "ticketcf", "ticketid");
$xtpl->assign("CUSTOMFIELD", $custfld);
$xtpl->parse("main");
$xtpl->out("main");
require_once('modules/uploads/binaryfilelist.php');
echo '
';
echo '