retrieve_entity_info($_REQUEST['record'],"HelpDesk");
    $focus->name=$focus->column_fields['ticket_title'];
}
if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
        $focus->id = "";
}
//Added code for Error display in sending mail to assigned to user when ticket is created or updated.
if($_REQUEST['message'] != '' && $_REQUEST['message'] != 1 && $focus->column_fields['assigned_user_id'] != 0)
{
        $error_message = '
Mail could not be sent to "Assigned To" user. ';
        if(@strstr($_REQUEST['message'],'Language string failed to load: connect_host'))
                $error_message .= 'Please check the mail server.';
        elseif(@strstr($_REQUEST['message'],'Language string failed to load: recipients_failed'))
                $error_message .= 'Please check the "Assigned to" email id.';
        $error_message .= ' " .$tempVal["filename"] ." ";
                $tempVal = $adb->fetch_array($wordTemplateResult);
        }
$xtpl->assign("WORDTEMPLATEOPTIONS","  ".$app_strings['LBL_SELECT_TEMPLATE_TO_MAIL_MERGE']."".$optionString." ");
}
$xtpl->parse("main");
$xtpl->out("main");
//Security check for related list
global $profile_id;
$tab_per_Data = getAllTabsPermission($profile_id);
$permissionData = $_SESSION['action_permission_set'];
$focus->id = $_REQUEST['record'];
getRelatedLists("HelpDesk",$focus);
Get_Ticket_History();
function getCommentInformation($ticketid)
{
	global $adb;
	global $mod_strings;
	$sql = "select * from ticketcomments where ticketid=".$ticketid;
	$result = $adb->query($sql);
	$noofrows = $adb->num_rows($result);
	if($noofrows == 0)
		return '';
	$list .= '';
        for($i=0;$i<$noofrows;$i++)
        {
		if($adb->query_result($result,$i,'comments') != '')
		{
                        $list .= '
';
                        $list .= nl2br($adb->query_result($result,$i,'comments'));
			$list .= '
';
        	        $list .= $mod_strings['LBL_AUTHOR'].' : ';
			if($adb->query_result($result,$i,'ownertype') == 'user')
				$list .= getUserName($adb->query_result($result,$i,'ownerid'));
			else
				$list .= getCustomerName($ticketid);
			$list .= ' on '.$adb->query_result($result,$i,'createdtime').'  ';
			$list .= ' 
';
		}
	}
	$list .= '