$lead_name .= ' ' . $focus->firstname;
}
$smarty->assign("NAME", $lead_name);
$smarty->assign("UPDATEINFO", updateInfo($focus->id));
$smarty->assign("BLOCKS", getBlocks($currentModule, "detail_view", '', $focus->column_fields));
$smarty->assign("CUSTOMFIELD", $cust_fld);
if (useInternalMailer() == 1) {
    $smarty->assign("INT_MAILER", "true");
}
$val = isPermitted("Leads", "EditView", $_REQUEST['record']);
if (isPermitted("Leads", "EditView", $_REQUEST['record']) == 'yes') {
    $smarty->assign("EDIT_DUPLICATE", "permitted");
}
require_once 'modules/Leads/ConvertLeadUI.php';
$uiinfo = new ConvertLeadUI($_REQUEST['record'], $current_user);
if (isPermitted("Leads", "EditView", $_REQUEST['record']) == 'yes' && isPermitted("Leads", "ConvertLead") == 'yes' && (isPermitted("Accounts", "EditView") == 'yes' || isPermitted("Contacts", "EditView") == 'yes') && (vtlib_isModuleActive('Contacts') || vtlib_isModuleActive('Accounts')) && !isLeadConverted($focus->id) && ($uiinfo->getCompany() != null || $uiinfo->isModuleActive('Contacts') == true)) {
    $smarty->assign("CONVERTLEAD", "permitted");
}
$category = getParentTab();
$smarty->assign("CATEGORY", $category);
if (isPermitted("Leads", "Delete", $_REQUEST['record']) == 'yes') {
    $smarty->assign("DELETE", "permitted");
}
if (isPermitted("Emails", "EditView", '') == 'yes') {
    //Added to pass the parents list as hidden for Emails -- 09-11-2005
    $parent_email = getEmailParentsList('Leads', $_REQUEST['record'], $focus);
    $smarty->assign("HIDDEN_PARENTS_LIST", $parent_email);
    $vtwsObject = VtigerWebserviceObject::fromName($adb, $currentModule);
    $vtwsCRMObjectMeta = new VtigerCRMObjectMeta($vtwsObject, $current_user);
    $emailFields = $vtwsCRMObjectMeta->getEmailFields();
    $smarty->assign("SENDMAILBUTTON", "permitted");
}
if ($singlepane_view == 'true') {
    $related_array = getRelatedLists($currentModule, $focus);
    $smarty->assign("RELATEDLISTS", $related_array);
    require_once 'include/ListView/RelatedListViewSession.php';
    if (!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
        RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']), vtlib_purify($_REQUEST['selected_header']));
    }
    $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
    $smarty->assign("SELECTEDHEADERS", $open_related_modules);
}
if (isPermitted($currentModule, 'EditView', $record) == 'yes') {
    $smarty->assign('EDIT_DUPLICATE', 'permitted');
    require_once 'modules/Leads/ConvertLeadUI.php';
    $uiinfo = new ConvertLeadUI($record, $current_user);
    if (isPermitted('Leads', 'ConvertLead') == 'yes' && (isPermitted('Accounts', 'EditView') == 'yes' || isPermitted('Contacts', 'EditView') == 'yes') && (vtlib_isModuleActive('Contacts') || vtlib_isModuleActive('Accounts')) && !isLeadConverted($focus->id) && ($uiinfo->getCompany() != null || $uiinfo->isModuleActive('Contacts') == true)) {
        $smarty->assign('CONVERTLEAD', 'permitted');
    }
}
if (isPermitted($currentModule, 'Delete', $record) == 'yes') {
    $smarty->assign('DELETE', 'permitted');
}
$smarty->assign('BLOCKS', getBlocks($currentModule, 'detail_view', '', $focus->column_fields));
// Gather the custom link information to display
include_once 'vtlib/Vtiger/Link.php';
$customlink_params = array('MODULE' => $currentModule, 'RECORD' => $focus->id, 'ACTION' => vtlib_purify($_REQUEST['action']));
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), array('DETAILVIEWBASIC', 'DETAILVIEW', 'DETAILVIEWWIDGET'), $customlink_params));
// Record Change Notification
$focus->markAsViewed($current_user->id);
$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
$smarty->display('DetailView.tpl');