예제 #1
0
    if (isset($arQuote['LEAD_ID']) && intval($arQuote['LEAD_ID']) > 0) {
        $arQuote['LEAD_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Lead, 'ENTITY_ID' => $arQuote['LEAD_ID'], 'PREFIX' => uniqid("crm_lead_link_"), 'TITLE' => $arQuote['~LEAD_TITLE'], 'CLASS_NAME' => ''));
    }
    if (isset($arQuote['DEAL_ID']) && intval($arQuote['DEAL_ID']) > 0) {
        $arQuote['DEAL_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Deal, 'ENTITY_ID' => $arQuote['DEAL_ID'], 'PREFIX' => uniqid("crm_deal_link_"), 'TITLE' => $arQuote['~DEAL_TITLE'], 'CLASS_NAME' => ''));
    }
    $arQuote['FORMATTED_ENTITIES_LINKS'] = '<div class="crm-info-links-wrapper">' . PHP_EOL . "\t" . '<div class="crm-info-contact-wrapper">' . (isset($arQuote['CONTACT_LINK_HTML']) ? htmlspecialchars_decode($arQuote['CONTACT_LINK_HTML']) : '') . '</div>' . PHP_EOL . "\t" . '<div class="crm-info-company-wrapper">' . (isset($arQuote['COMPANY_LINK_HTML']) ? $arQuote['COMPANY_LINK_HTML'] : '') . '</div>' . PHP_EOL . "\t" . '<div class="crm-info-lead-wrapper">' . (isset($arQuote['LEAD_LINK_HTML']) ? $arQuote['LEAD_LINK_HTML'] : '') . '</div>' . PHP_EOL . "\t" . '<div class="crm-info-deal-wrapper">' . (isset($arQuote['DEAL_LINK_HTML']) ? $arQuote['DEAL_LINK_HTML'] : '') . '</div>' . PHP_EOL . '</div>' . PHP_EOL;
    // color coding
    $arQuote['EXPIRED_FLAG'] = false;
    $arQuote['IN_COUNTER_FLAG'] = false;
    if (!empty($arQuote['CLOSEDATE'])) {
        $tsCloseDate = MakeTimeStamp($arQuote['CLOSEDATE']);
        $tsNow = time() + CTimeZone::GetOffset();
        $tsMax = mktime(0, 0, 0, date('m', $tsNow), date('d', $tsNow), date('Y', $tsNow));
        $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arQuote);
        $bReckoned = CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentQuoteActivies, $counterData);
        if ($bReckoned) {
            $arQuote['IN_COUNTER_FLAG'] = true;
            if ($tsCloseDate < $tsMax) {
                $arQuote['EXPIRED_FLAG'] = true;
            }
        }
        unset($tsCloseDate, $tsNow, $counterData);
    }
    $arResult['QUOTE'][$entityID] = $arQuote;
    $arResult['QUOTE_UF'][$entityID] = array();
    $arResult['QUOTE_ID'][$entityID] = $entityID;
}
$arResult['ROWS_COUNT'] = $obRes->SelectedRowsCount();
$arResult['DB_LIST'] = $obRes;
$arResult['DB_FILTER'] = $arFilter;
예제 #2
0
        $resultItem['columns']['BIRTHDATE'] = '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arLead['~BIRTHDATE'])) . '</nobr>';
    }
    $userActivityID = isset($arLead['~ACTIVITY_ID']) ? intval($arLead['~ACTIVITY_ID']) : 0;
    $commonActivityID = isset($arLead['~C_ACTIVITY_ID']) ? intval($arLead['~C_ACTIVITY_ID']) : 0;
    if ($userActivityID > 0) {
        $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arLead['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $userActivityID, 'ACTIVITY_SUBJECT' => isset($arLead['~ACTIVITY_SUBJECT']) ? $arLead['~ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arLead['~ACTIVITY_TIME']) ? $arLead['~ACTIVITY_TIME'] : '', 'ACTIVITY_EXPIRED' => isset($arLead['~ACTIVITY_EXPIRED']) ? $arLead['~ACTIVITY_EXPIRED'] : '', 'ALLOW_EDIT' => $arLead['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
        $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arLead, 'ACTIVITY' => array('RESPONSIBLE_ID' => $currentUserID, 'TIME' => isset($arLead['~ACTIVITY_TIME']) ? $arLead['~ACTIVITY_TIME'] : '', 'IS_CURRENT_DAY' => isset($arLead['~ACTIVITY_IS_CURRENT_DAY']) ? $arLead['~ACTIVITY_IS_CURRENT_DAY'] : false));
        if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentLeadActivies, $counterData)) {
            $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-deal-today');
        }
    } elseif ($commonActivityID > 0) {
        $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arLead['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $commonActivityID, 'ACTIVITY_SUBJECT' => isset($arLead['~C_ACTIVITY_SUBJECT']) ? $arLead['~C_ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arLead['~C_ACTIVITY_TIME']) ? $arLead['~C_ACTIVITY_TIME'] : '', 'ACTIVITY_RESPONSIBLE_ID' => isset($arLead['~C_ACTIVITY_RESP_ID']) ? intval($arLead['~C_ACTIVITY_RESP_ID']) : 0, 'ACTIVITY_RESPONSIBLE_LOGIN' => isset($arLead['~C_ACTIVITY_RESP_LOGIN']) ? $arLead['~C_ACTIVITY_RESP_LOGIN'] : '', 'ACTIVITY_RESPONSIBLE_NAME' => isset($arLead['~C_ACTIVITY_RESP_NAME']) ? $arLead['~C_ACTIVITY_RESP_NAME'] : '', 'ACTIVITY_RESPONSIBLE_LAST_NAME' => isset($arLead['~C_ACTIVITY_RESP_LAST_NAME']) ? $arLead['~C_ACTIVITY_RESP_LAST_NAME'] : '', 'ACTIVITY_RESPONSIBLE_SECOND_NAME' => isset($arLead['~C_ACTIVITY_RESP_SECOND_NAME']) ? $arLead['~C_ACTIVITY_RESP_SECOND_NAME'] : '', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'ALLOW_EDIT' => $arLead['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
    } else {
        $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'ENTITY_ID' => $arLead['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arLead['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ALLOW_EDIT' => $arLead['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
        $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arLead);
        if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentLeadActivies, $counterData)) {
            $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-enitity-action-need');
        }
    }
    $arResult['GRID_DATA'][] =& $resultItem;
    unset($resultItem);
}
$APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('AJAX_ONLY' => 'Y'), false, array('HIDE_ICONS' => 'Y'));
$isEditable = $arResult['PERMS']['WRITE'] && !$arResult['INTERNAL'];
$actionHtml = '';
if ($isEditable) {
    // Setup STATUS_ID -->
    $statuses = '<div id="ACTION_STATUS_WRAPPER" style="display:none;"><select name="ACTION_STATUS_ID" size="1">';
    $statuses .= '<option value="" title="' . GetMessage('CRM_STATUS_INIT') . '" selected="selected">' . GetMessage('CRM_STATUS_INIT') . '</option>';
    foreach ($arResult['STATUS_LIST_WRITE'] as $id => $name) {
        $name = htmlspecialcharsbx($name);
예제 #3
0
        $arActions[] = array('SEPARATOR' => true);
        $arActions[] = array('ICONCLASS' => 'delete', 'TITLE' => GetMessage('CRM_CONTACT_DELETE_TITLE'), 'TEXT' => GetMessage('CRM_CONTACT_DELETE'), 'ONCLICK' => "crm_contact_delete_grid('" . CUtil::JSEscape(GetMessage('CRM_CONTACT_DELETE_TITLE')) . "', '" . CUtil::JSEscape(GetMessage('CRM_CONTACT_DELETE_CONFIRM')) . "', '" . CUtil::JSEscape(GetMessage('CRM_CONTACT_DELETE')) . "', '" . CUtil::JSEscape($arContact['PATH_TO_CONTACT_DELETE']) . "')");
    }
    $_sBPHint = 'class="' . ($arContact['BIZPROC_STATUS'] != '' ? 'bizproc bizproc_status_' . $arContact['BIZPROC_STATUS'] : '') . '"
					' . ($arContact['BIZPROC_STATUS_HINT'] != '' ? 'onmouseover="BX.hint(this, \'' . CUtil::JSEscape($arContact['BIZPROC_STATUS_HINT']) . '\');"' : '');
    $companyID = isset($arContact['~COMPANY_ID']) ? intval($arContact['~COMPANY_ID']) : 0;
    $resultItem = array('id' => $arContact['ID'], 'actions' => $arActions, 'data' => $arContact, 'editable' => !$arContact['EDIT'] ? $arResult['INTERNAL'] ? 'N' : $arColumns : 'Y', 'columns' => array('CONTACT_SUMMARY' => CCrmViewHelper::RenderClientSummary($arContact['PATH_TO_CONTACT_SHOW'], $arContact['CONTACT_FORMATTED_NAME'], $arContact['CONTACT_TYPE_NAME'], isset($arContact['PHOTO']) ? $arContact['PHOTO'] : ''), 'CONTACT_COMPANY' => $companyID > 0 ? CCrmViewHelper::PrepareClientInfo(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID, 'TITLE' => isset($arContact['~COMPANY_TITLE']) ? $arContact['~COMPANY_TITLE'] : '[' . $companyID . ']', 'PREFIX' => "CONTACT_{$arContact['~ID']}", 'DESCRIPTION' => isset($arContact['~POST']) ? $arContact['~POST'] : '')) : '', 'ASSIGNED_BY' => $arContact['~ASSIGNED_BY'] > 0 ? '<a href="' . $arContact['PATH_TO_USER_PROFILE'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '">' . $arContact['ASSIGNED_BY'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arContact['~ASSIGNED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '", "");</script>' : '', 'ADDRESS' => nl2br($arContact['ADDRESS']), 'COMMENTS' => htmlspecialcharsback($arContact['COMMENTS']), 'COMPANY_ID' => isset($arContact['COMPANY_TITLE']) ? '<a href="' . $arContact['PATH_TO_COMPANY_SHOW'] . '" id="balloon_' . $arResult['GRID_ID'] . '_CO_' . $arContact['ID'] . '">' . $arContact['COMPANY_TITLE'] . '</a>' . '<script type="text/javascript">BX.tooltip("COMPANY_' . $arContact['~COMPANY_ID'] . '", "balloon_' . $arResult['GRID_ID'] . '_CO_' . $arContact['ID'] . '", "/bitrix/components/bitrix/crm.company.show/card.ajax.php", "crm_balloon_company", true);</script>' : '', 'SOURCE_DESCRIPTION' => nl2br($arContact['SOURCE_DESCRIPTION']), 'DATE_CREATE' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arContact['DATE_CREATE'])) . '</nobr>', 'DATE_MODIFY' => '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arContact['DATE_MODIFY'])) . '</nobr>', 'TYPE_ID' => isset($arResult['TYPE_LIST'][$arContact['TYPE_ID']]) ? $arResult['TYPE_LIST'][$arContact['TYPE_ID']] : $arContact['TYPE_ID'], 'SOURCE_ID' => isset($arResult['SOURCE_LIST'][$arContact['SOURCE_ID']]) ? $arResult['SOURCE_LIST'][$arContact['SOURCE_ID']] : $arContact['SOURCE_ID'], 'CREATED_BY' => $arContact['~CREATED_BY'] > 0 ? '<a href="' . $arContact['PATH_TO_USER_CREATOR'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '">' . $arContact['CREATED_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arContact['~CREATED_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '", "");</script>' : '', 'MODIFY_BY' => $arContact['~MODIFY_BY'] > 0 ? '<a href="' . $arContact['PATH_TO_USER_MODIFIER'] . '" id="balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '">' . $arContact['MODIFY_BY_FORMATTED_NAME'] . '</a>' . '<script type="text/javascript">BX.tooltip(' . $arContact['~MODIFY_BY'] . ', "balloon_' . $arResult['GRID_ID'] . '_' . $arContact['ID'] . '", "");</script>' : '') + CCrmViewHelper::RenderListMultiFields($arContact, "CONTACT_{$arContact['ID']}_", array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::ContactName, 'ENTITY_ID' => $arContact['ID']))) + $arResult['CONTACT_UF'][$sKey]);
    if (isset($arContact['~BIRTHDATE'])) {
        $resultItem['columns']['BIRTHDATE'] = '<nobr>' . FormatDate('SHORT', MakeTimeStamp($arContact['~BIRTHDATE'])) . '</nobr>';
    }
    $userActivityID = isset($arContact['~ACTIVITY_ID']) ? intval($arContact['~ACTIVITY_ID']) : 0;
    $commonActivityID = isset($arContact['~C_ACTIVITY_ID']) ? intval($arContact['~C_ACTIVITY_ID']) : 0;
    if ($userActivityID > 0) {
        $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Contact), 'ENTITY_ID' => $arContact['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arContact['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $userActivityID, 'ACTIVITY_SUBJECT' => isset($arContact['~ACTIVITY_SUBJECT']) ? $arContact['~ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arContact['~ACTIVITY_TIME']) ? $arContact['~ACTIVITY_TIME'] : '', 'ACTIVITY_EXPIRED' => isset($arContact['~ACTIVITY_EXPIRED']) ? $arContact['~ACTIVITY_EXPIRED'] : '', 'ALLOW_EDIT' => $arContact['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
        $counterData = array('CURRENT_USER_ID' => $currentUserID, 'ENTITY' => $arContact, 'ACTIVITY' => array('RESPONSIBLE_ID' => $currentUserID, 'TIME' => isset($arContact['~ACTIVITY_TIME']) ? $arContact['~ACTIVITY_TIME'] : '', 'IS_CURRENT_DAY' => isset($arContact['~ACTIVITY_IS_CURRENT_DAY']) ? $arContact['~ACTIVITY_IS_CURRENT_DAY'] : false));
        if (CCrmUserCounter::IsReckoned(CCrmUserCounter::CurrentContactActivies, $counterData)) {
            $resultItem['columnClasses'] = array('ACTIVITY_ID' => 'crm-list-deal-today');
        }
    } elseif ($commonActivityID > 0) {
        $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Contact), 'ENTITY_ID' => $arContact['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arContact['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ACTIVITY_ID' => $commonActivityID, 'ACTIVITY_SUBJECT' => isset($arContact['~C_ACTIVITY_SUBJECT']) ? $arContact['~C_ACTIVITY_SUBJECT'] : '', 'ACTIVITY_TIME' => isset($arContact['~C_ACTIVITY_TIME']) ? $arContact['~C_ACTIVITY_TIME'] : '', 'ACTIVITY_RESPONSIBLE_ID' => isset($arContact['~C_ACTIVITY_RESP_ID']) ? intval($arContact['~C_ACTIVITY_RESP_ID']) : 0, 'ACTIVITY_RESPONSIBLE_LOGIN' => isset($arContact['~C_ACTIVITY_RESP_LOGIN']) ? $arContact['~C_ACTIVITY_RESP_LOGIN'] : '', 'ACTIVITY_RESPONSIBLE_NAME' => isset($arContact['~C_ACTIVITY_RESP_NAME']) ? $arContact['~C_ACTIVITY_RESP_NAME'] : '', 'ACTIVITY_RESPONSIBLE_LAST_NAME' => isset($arContact['~C_ACTIVITY_RESP_LAST_NAME']) ? $arContact['~C_ACTIVITY_RESP_LAST_NAME'] : '', 'ACTIVITY_RESPONSIBLE_SECOND_NAME' => isset($arContact['~C_ACTIVITY_RESP_SECOND_NAME']) ? $arContact['~C_ACTIVITY_RESP_SECOND_NAME'] : '', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'PATH_TO_USER_PROFILE' => $arParams['PATH_TO_USER_PROFILE'], 'ALLOW_EDIT' => $arContact['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
    } else {
        $resultItem['columns']['ACTIVITY_ID'] = CCrmViewHelper::RenderNearestActivity(array('ENTITY_TYPE_NAME' => CCrmOwnerType::ResolveName(CCrmOwnerType::Contact), 'ENTITY_ID' => $arContact['~ID'], 'ENTITY_RESPONSIBLE_ID' => $arContact['~ASSIGNED_BY'], 'GRID_MANAGER_ID' => $gridManagerID, 'ALLOW_EDIT' => $arContact['EDIT'], 'MENU_ITEMS' => $arActivityMenuItems));
    }
    $arResult['GRID_DATA'][] =& $resultItem;
    unset($resultItem);
}
$APPLICATION->IncludeComponent('bitrix:main.user.link', '', array('AJAX_ONLY' => 'Y'), false, array('HIDE_ICONS' => 'Y'));
$isEditable = $arResult['PERMS']['WRITE'] && !$arResult['INTERNAL'];
$actionHtml = '';
if ($isEditable) {
    // Setup ASSIGNED_BY_ID -->