本文整理汇总了PHP中CCrmOwnerType::GetShowUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmOwnerType::GetShowUrl方法的具体用法?PHP CCrmOwnerType::GetShowUrl怎么用?PHP CCrmOwnerType::GetShowUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmOwnerType
的用法示例。
在下文中一共展示了CCrmOwnerType::GetShowUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetCrmActivityCommunicationsPage
function GetCrmActivityCommunicationsPage($ID, $pageSize, $pageNumber)
{
$dbRes = CCrmActivity::GetCommunicationList(array('ID' => 'ASC'), array('ACTIVITY_ID' => $ID), false, array('bShowAll' => false, 'nPageSize' => $pageSize, 'iNumPage' => $pageNumber));
$communicationData = array();
while ($result = $dbRes->Fetch()) {
$result['ENTITY_SETTINGS'] = isset($result['ENTITY_SETTINGS']) && $result['ENTITY_SETTINGS'] !== '' ? unserialize($result['ENTITY_SETTINGS']) : array();
CCrmActivity::PrepareCommunicationInfo($result);
$communicationData[] = array('id' => $result['ID'], 'type' => $result['TYPE'], 'value' => $result['VALUE'], 'entityId' => $result['ENTITY_ID'], 'entityType' => CCrmOwnerType::ResolveName($result['ENTITY_TYPE_ID']), 'entityTitle' => $result['TITLE'], 'entityUrl' => CCrmOwnerType::GetShowUrl($result['ENTITY_TYPE_ID'], $result['ENTITY_ID']));
}
return array('DATA' => array('ID' => $ID, 'PAGE_SIZE' => $dbRes->NavPageSize, 'PAGE_NUMBER' => $dbRes->NavPageNomer, 'PAGE_COUNT' => $dbRes->NavPageCount, 'COMMUNICATIONS' => $communicationData));
}
示例2: showField
//.........这里部分代码省略.........
if (is_array($arField["VALUE"]) && (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0 || array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0 || array_key_exists("COMPANY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["COMPANY_ID"]) > 0)) {
$strResult .= "#row_begin#";
$strResult .= "#cell_begin_left#";
$strResult .= $arField["TITLE"] . ":";
$strResult .= "#cell_end#";
$strResult .= "#cell_begin_right#";
if (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0 || array_key_exists("CONTACT_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_NAME"]) > 0 || array_key_exists("CONTACT_LAST_NAME", $arField["VALUE"]) && strlen($arField["VALUE"]["CONTACT_LAST_NAME"]) > 0) {
if (array_key_exists("CONTACT_ID", $arField["VALUE"]) && intval($arField["VALUE"]["CONTACT_ID"]) > 0) {
$strResult .= '<div class="crm-feed-client-block">';
$strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
$dbRes = CCrmContact::GetListEx(array(), array('=ID' => $arField["VALUE"]["CONTACT_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('PHOTO', 'COMPANY_ID'));
if ($arRes = $dbRes->Fetch()) {
$contactCompanyID = $arRes['COMPANY_ID'];
if (intval($arRes["PHOTO"]) > 0) {
$arFileTmp = CFile::ResizeImageGet($arRes["PHOTO"], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
$strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
}
}
}
$strResult .= '</span>';
$strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arField["VALUE"]["CONTACT_ID"], 'PREFIX' => '', 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
} else {
$strResult .= '<div class="crm-feed-client-block">';
$strResult .= '<span class="feed-com-avatar crm-feed-user-avatar">';
if (intval($arField['VALUE']['PHOTO_ID']) > 0) {
$arFileTmp = CFile::ResizeImageGet($arField['VALUE']['PHOTO_ID'], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
$strResult .= '<img width="39" height="39" src="' . $arFileTmp['src'] . '" alt="">';
}
}
$strResult .= '</span>';
if (array_key_exists("ENTITY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["ENTITY_ID"]) > 0) {
$url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Contact, $arField["VALUE"]["ENTITY_ID"], true);
}
$clientName = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($arField['VALUE']['HONORIFIC']) ? $arField['VALUE']['HONORIFIC'] : '', 'NAME' => isset($arField['VALUE']['CONTACT_NAME']) ? $arField['VALUE']['CONTACT_NAME'] : '', 'LAST_NAME' => isset($arField['VALUE']['CONTACT_LAST_NAME']) ? $arField['VALUE']['CONTACT_LAST_NAME'] : '', 'SECOND_NAME' => isset($arField['VALUE']['CONTACT_SECOND_NAME']) ? $arField['VALUE']['CONTACT_SECOND_NAME'] : ''));
$strResult .= strlen($url) > 0 ? '<a href="' . $url . '" class="crm-feed-client-name">' . $clientName . '</a>' : $clientName;
}
$strResult .= '<span class="crm-feed-client-company">';
$strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => array_key_exists("COMPANY_ID", $arField["VALUE"]) && intval($arField["VALUE"]["COMPANY_ID"]) > 0 ? $arField["VALUE"]["COMPANY_ID"] : intval($contactCompanyID), 'PREFIX' => '', 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
$strResult .= '</span>';
$strResult .= '</div>';
} else {
$strResult .= CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $arField["VALUE"]["COMPANY_ID"], 'PREFIX' => "", 'CLASS_NAME' => '', 'CHECK_PERMISSIONS' => 'N'));
}
$strResult .= "#cell_end#";
$strResult .= "#row_end#";
}
break;
case "COMBI_COMPANY":
if (is_array($arField["VALUE"]) && (array_key_exists("TITLE", $arField["VALUE"]) && strlen($arField["VALUE"]["TITLE"]) > 0)) {
$strResult .= "#row_begin#";
$strResult .= "#cell_begin_left#";
$strResult .= $arField["TITLE"] . ":";
$strResult .= "#cell_end#";
$strResult .= "#cell_begin_right#";
$url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $arField["VALUE"]["ENTITY_ID"]);
if (intval($arField['VALUE']['LOGO_ID']) > 0) {
$arFileTmp = CFile::ResizeImageGet($arField['VALUE']['LOGO_ID'], array('width' => 39, 'height' => 39), BX_RESIZE_IMAGE_EXACT, false);
}
if (is_array($arFileTmp) && isset($arFileTmp['src'])) {
$strResult .= '<a class="crm-feed-user-block" href="' . $url . '">';
$strResult .= '<span class="feed-com-avatar crm-feed-company-avatar">';
$strResult .= '<img width="39" height="39" alt="" src="' . $arFileTmp['src'] . '">';
$strResult .= '</span>';
$strResult .= '<span class="crm-feed-user-name">' . $arField["VALUE"]["TITLE"] . '</span>';
示例3: __CrmQuickPanelViewPrepareCompanyInfo
function __CrmQuickPanelViewPrepareCompanyInfo($entityFields, &$entityContext, $key = '', $useTildeKey = true)
{
if ($key === '') {
$key = 'COMPANY';
}
$map = array('ID' => ($useTildeKey ? '~' : '') . $key . '_ID', 'TITLE' => ($useTildeKey ? '~' : '') . $key . '_TITLE', 'LOGO' => ($useTildeKey ? '~' : '') . $key . '_LOGO');
$entityContext['COMPANY_INFO'] = array('ID' => isset($entityFields[$map['ID']]) ? (int) $entityFields[$map['ID']] : 0, 'TITLE' => '');
if ($entityContext['COMPANY_INFO']['ID'] > 0 && isset($entityFields[$map['TITLE']])) {
$entityContext['COMPANY_INFO']['TITLE'] = $entityFields[$map['TITLE']];
$entityContext['COMPANY_INFO']['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $entityContext['COMPANY_INFO']['ID'], false);
if (isset($entityFields[$map['LOGO']])) {
$file = new CFile();
$fileInfo = $file->ResizeImageGet($entityFields[$map['LOGO']], array('width' => 48, 'height' => 31), BX_RESIZE_IMAGE_PROPORTIONAL);
$entityContext['COMPANY_INFO']['IMAGE_URL'] = is_array($fileInfo) && isset($fileInfo['src']) ? $fileInfo['src'] : '';
} else {
$entityContext['COMPANY_INFO']['IMAGE_URL'] = '';
}
$entityContext['COMPANY_INFO']['FM'] = __CrmQuickPanelViewLoadMultiFields(CCrmOwnerType::CompanyName, $entityContext['COMPANY_INFO']['ID']);
$entityContext['COMPANY_INFO']['MULTI_FIELDS_OPTIONS'] = array('ENABLE_SIP' => true, 'SIP_PARAMS' => array('ENTITY_TYPE' => 'CRM_' . CCrmOwnerType::CompanyName, 'ENTITY_ID' => $entityContext['COMPANY_INFO']['ID']));
}
}
示例4: GetDocumentAdminPage
public static function GetDocumentAdminPage($documentId)
{
$arDocumenInfo = self::GetDocumentInfo($documentId);
if (empty($arDocumenInfo)) {
return null;
}
$entityTypeName = isset($arDocumenInfo['TYPE']) ? $arDocumenInfo['TYPE'] : '';
$entityTypeID = $entityTypeName !== '' ? CCrmOwnerType::ResolveID($entityTypeName) : CCrmOwnerType::Undefined;
$entityID = isset($arDocumenInfo['ID']) ? intval($arDocumenInfo['ID']) : 0;
return $entityTypeID !== CCrmOwnerType::Undefined && $entityID > 0 ? CCrmOwnerType::GetShowUrl($entityTypeID, $entityID, false) : null;
}
示例5: isset
$entityID = isset($_POST['ENITY_ID']) ? intval($_POST['ENITY_ID']) : 0;
if ($entityID <= 0) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'ENITY ID IS INVALID OR NOT DEFINED!'));
}
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'Y'), false, false, array('TITLE', 'LOGO'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (!$arRes) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'ENITY IS NOT FOUND!'));
} else {
if (!isset($arRes['LOGO'])) {
$imageUrl = '';
} else {
$fileInfo = CFile::ResizeImageGet($arRes['LOGO'], array('width' => 42, 'height' => 42), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$imageUrl = isset($fileInfo['src']) ? $fileInfo['src'] : '';
}
__CrmCompanyShowEndJsonResonse(array('DATA' => array('TITLE' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'LEGEND' => '', 'IMAGE_URL' => $imageUrl, 'SHOW_URL' => CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $entityID, false))));
}
}
$type = isset($_POST['OWNER_TYPE']) ? strtoupper($_POST['OWNER_TYPE']) : '';
if ($type !== 'CO') {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'OWNER_TYPE IS NOT SUPPORTED!'));
}
if (!CCrmCompany::CheckUpdatePermission(0)) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'PERMISSION DENIED!'));
}
if ($mode === 'UPDATE') {
$ID = isset($_POST['OWNER_ID']) ? $_POST['OWNER_ID'] : 0;
if ($ID <= 0) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'ID IS INVALID OR NOT DEFINED!'));
}
if (!CCrmCompany::CheckUpdatePermission($ID)) {
示例6: Update
//.........这里部分代码省略.........
if ($bUpdateSearch) {
$arFilterTmp = array('ID' => $ID);
if (!$this->bCheckPermission) {
$arFilterTmp['CHECK_PERMISSIONS'] = 'N';
}
CCrmSearch::UpdateSearch($arFilterTmp, 'DEAL', true);
}
$arFields['ID'] = $ID;
if (isset($arFields['FM']) && is_array($arFields['FM'])) {
$CCrmFieldMulti = new CCrmFieldMulti();
$CCrmFieldMulti->SetFields('DEAL', $ID, $arFields['FM']);
}
// Responsible user sync
//CCrmActivity::Synchronize(CCrmOwnerType::Deal, $ID);
$registerSonetEvent = isset($options['REGISTER_SONET_EVENT']) && $options['REGISTER_SONET_EVENT'] === true;
if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Deal, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
}
if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
//CONTACT
$newContactID = isset($arFields['CONTACT_ID']) ? intval($arFields['CONTACT_ID']) : 0;
$oldContactID = isset($arRow['CONTACT_ID']) ? intval($arRow['CONTACT_ID']) : 0;
$contactID = $newContactID > 0 ? $newContactID : $oldContactID;
//COMPANY
$newCompanyID = isset($arFields['COMPANY_ID']) ? intval($arFields['COMPANY_ID']) : 0;
$oldCompanyID = isset($arRow['COMPANY_ID']) ? intval($arRow['COMPANY_ID']) : 0;
$companyID = $newCompanyID > 0 ? $newCompanyID : $oldCompanyID;
$modifiedByID = intval($arFields['MODIFY_BY_ID']);
foreach ($sonetEventData as &$sonetEvent) {
$sonetEventType = $sonetEvent['TYPE'];
$sonetEventCode = isset($sonetEvent['CODE']) ? $sonetEvent['CODE'] : '';
$sonetEventFields =& $sonetEvent['FIELDS'];
$sonetEventFields['ENTITY_TYPE_ID'] = CCrmOwnerType::Deal;
$sonetEventFields['ENTITY_ID'] = $ID;
$sonetEventFields['USER_ID'] = $modifiedByID;
//Register contact & company relations
if ($sonetEventCode === 'CLIENT') {
$sonetEventFields['PARENTS'] = array();
//If contact changed bind events to old and new contacts
if ($oldContactID !== $newContactID) {
if ($oldContactID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $oldContactID);
}
if ($newContactID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $newContactID);
}
}
//If company changed bind events to old and new companies
if ($oldCompanyID !== $newCompanyID) {
if ($oldCompanyID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $oldCompanyID);
}
if ($newCompanyID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $newCompanyID);
}
}
} elseif ($contactID > 0 || $companyID > 0) {
$sonetEventFields['PARENTS'] = array();
if ($contactID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $contactID);
}
if ($companyID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID);
}
}
$logEventID = CCrmLiveFeed::CreateLogEvent($sonetEventFields, $sonetEventType);
if ($logEventID && CModule::IncludeModule("im")) {
$url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $ID);
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible && $sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "deal_update", "NOTIFY_TAG" => "CRM|DEAL_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_DEAL_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_DEAL_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible && $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "deal_update", "NOTIFY_TAG" => "CRM|DEAL_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_DEAL_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_DEAL_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Progress && $sonetEventFields['PARAMS']['START_STATUS_ID'] && $sonetEventFields['PARAMS']['FINAL_STATUS_ID']) {
$assignedByID = isset($arFields['ASSIGNED_BY_ID']) ? $arFields['ASSIGNED_BY_ID'] : $arRow['ASSIGNED_BY_ID'];
$infos = CCrmStatus::GetStatus('DEAL_STAGE');
if ($assignedByID != $modifiedByID && array_key_exists($sonetEventFields['PARAMS']['START_STATUS_ID'], $infos) && array_key_exists($sonetEventFields['PARAMS']['FINAL_STATUS_ID'], $infos)) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $assignedByID, "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "deal_update", "NOTIFY_TAG" => "CRM|DEAL_PROGRESS|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_DEAL_PROGRESS_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>", "#start_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['START_STATUS_ID']]['NAME']), "#final_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['FINAL_STATUS_ID']]['NAME']))), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_DEAL_PROGRESS_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']), "#start_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['START_STATUS_ID']]['NAME']), "#final_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['FINAL_STATUS_ID']]['NAME']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
}
}
unset($sonetEventFields);
}
unset($sonetEvent);
}
if ($bResult) {
$afterEvents = GetModuleEvents('crm', 'OnAfterCrmDealUpdate');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
}
self::PullChange('UPDATE', array('ID' => $ID));
}
return $bResult;
}
示例7: Update
//.........这里部分代码省略.........
$arRes = $dbRes->Fetch();
$arFields['FULL_NAME'] = trim((isset($arFields['NAME']) ? $arFields['NAME'] : $arRes['NAME']) . ' ' . (isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : $arRes['LAST_NAME']));
}
$sUpdate = $DB->PrepareUpdate('b_crm_lead', $arFields, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
if (strlen($sUpdate) > 0) {
$DB->Query("UPDATE b_crm_lead SET {$sUpdate} WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
if (isset($arFields['COMPANY_TITLE'])) {
$newCompanyTitle = $arFields['COMPANY_TITLE'];
$oldCompanyTitle = isset($arRow['COMPANY_TITLE']) ? $arRow['COMPANY_TITLE'] : '';
if ($newCompanyTitle !== $oldCompanyTitle) {
\Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::register(CCrmOwnerType::Lead, $ID, $newCompanyTitle);
}
}
if (isset($arFields['LAST_NAME']) || isset($arFields['NAME']) || isset($arFields['SECOND_NAME'])) {
$lastName = isset($arFields['LAST_NAME']) ? $arFields['LAST_NAME'] : (isset($arRow['LAST_NAME']) ? $arRow['LAST_NAME'] : '');
$name = isset($arFields['NAME']) ? $arFields['NAME'] : (isset($arRow['NAME']) ? $arRow['NAME'] : '');
$secondName = isset($arFields['SECOND_NAME']) ? $arFields['SECOND_NAME'] : (isset($arRow['SECOND_NAME']) ? $arRow['SECOND_NAME'] : '');
\Bitrix\Crm\Integrity\DuplicatePersonCriterion::register(CCrmOwnerType::Lead, $ID, $lastName, $name, $secondName);
}
$bResult = true;
}
if (defined("BX_COMP_MANAGED_CACHE")) {
static $arNameFields = array("TITLE");
$bClear = false;
foreach ($arNameFields as $val) {
if (isset($arFields[$val])) {
$bClear = true;
break;
}
}
if ($bClear) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Lead . "_" . $ID);
}
}
CCrmPerms::UpdateEntityAttr('LEAD', $ID, $arEntityAttr);
if (isset($arFields['ADDRESS']) || isset($arFields['ADDRESS_2']) || isset($arFields['ADDRESS_CITY']) || isset($arFields['ADDRESS_POSTAL_CODE']) || isset($arFields['ADDRESS_REGION']) || isset($arFields['ADDRESS_PROVINCE']) || isset($arFields['ADDRESS_COUNTRY'])) {
\Bitrix\Crm\EntityAddress::register(CCrmOwnerType::Lead, $ID, \Bitrix\Crm\EntityAddress::Primary, array('ADDRESS_1' => isset($arFields['ADDRESS']) ? $arFields['ADDRESS'] : (isset($arRow['ADDRESS']) ? $arRow['ADDRESS'] : null), 'ADDRESS_2' => isset($arFields['ADDRESS_2']) ? $arFields['ADDRESS_2'] : (isset($arRow['ADDRESS_2']) ? $arRow['ADDRESS_2'] : null), 'CITY' => isset($arFields['ADDRESS_CITY']) ? $arFields['ADDRESS_CITY'] : (isset($arRow['ADDRESS_CITY']) ? $arRow['ADDRESS_CITY'] : null), 'POSTAL_CODE' => isset($arFields['ADDRESS_POSTAL_CODE']) ? $arFields['ADDRESS_POSTAL_CODE'] : (isset($arRow['ADDRESS_POSTAL_CODE']) ? $arRow['ADDRESS_POSTAL_CODE'] : null), 'REGION' => isset($arFields['ADDRESS_REGION']) ? $arFields['ADDRESS_REGION'] : (isset($arRow['ADDRESS_REGION']) ? $arRow['ADDRESS_REGION'] : null), 'PROVINCE' => isset($arFields['ADDRESS_PROVINCE']) ? $arFields['ADDRESS_PROVINCE'] : (isset($arRow['ADDRESS_PROVINCE']) ? $arRow['ADDRESS_PROVINCE'] : null), 'COUNTRY' => isset($arFields['ADDRESS_COUNTRY']) ? $arFields['ADDRESS_COUNTRY'] : (isset($arRow['ADDRESS_COUNTRY']) ? $arRow['ADDRESS_COUNTRY'] : null), 'COUNTRY_CODE' => isset($arFields['ADDRESS_COUNTRY_CODE']) ? $arFields['ADDRESS_COUNTRY_CODE'] : (isset($arRow['ADDRESS_COUNTRY_CODE']) ? $arRow['ADDRESS_COUNTRY_CODE'] : null)));
}
CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
$GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
if (isset($arFields['FM']) && is_array($arFields['FM'])) {
$CCrmFieldMulti = new CCrmFieldMulti();
$CCrmFieldMulti->SetFields(CCrmOwnerType::LeadName, $ID, $arFields['FM']);
$multifields = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::prepareEntityMultifieldsValues(CCrmOwnerType::Lead, $ID);
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Lead, $ID, 'EMAIL', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'EMAIL'));
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Lead, $ID, 'PHONE', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'PHONE'));
}
\Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Lead, $ID, array_merge($arRow, $arFields));
if ($bUpdateSearch) {
CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'LEAD', true);
}
$arFields['ID'] = $ID;
// Responsible user sync
//CCrmActivity::Synchronize(CCrmOwnerType::Lead, $ID);
// Sonet events registration
$registerSonetEvent = isset($arOptions['REGISTER_SONET_EVENT']) && $arOptions['REGISTER_SONET_EVENT'] === true;
if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Lead, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
}
if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
$modifiedByID = intval($arFields['MODIFY_BY_ID']);
foreach ($sonetEventData as &$sonetEvent) {
$sonetEventFields =& $sonetEvent['FIELDS'];
$sonetEventFields['ENTITY_TYPE_ID'] = CCrmOwnerType::Lead;
$sonetEventFields['ENTITY_ID'] = $ID;
$sonetEventFields['USER_ID'] = $modifiedByID;
$logEventID = CCrmLiveFeed::CreateLogEvent($sonetEventFields, $sonetEvent['TYPE']);
if ($logEventID && CModule::IncludeModule("im")) {
$url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Lead, $ID);
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
if ($sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'] != $modifiedByID && $sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "lead_update", "NOTIFY_TAG" => "CRM|LEAD_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_LEAD_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LEAD_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible && $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "lead_update", "NOTIFY_TAG" => "CRM|LEAD_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_LEAD_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LEAD_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
if ($sonetEvent['TYPE'] == CCrmLiveFeedEvent::Progress && $sonetEventFields['PARAMS']['START_STATUS_ID'] && $sonetEventFields['PARAMS']['FINAL_STATUS_ID']) {
$assignedByID = isset($arFields['ASSIGNED_BY_ID']) ? $arFields['ASSIGNED_BY_ID'] : $arRow['ASSIGNED_BY_ID'];
$infos = CCrmStatus::GetStatus('STATUS');
if ($assignedByID != $modifiedByID && array_key_exists($sonetEventFields['PARAMS']['START_STATUS_ID'], $infos) && array_key_exists($sonetEventFields['PARAMS']['FINAL_STATUS_ID'], $infos)) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $assignedByID, "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "lead_update", "NOTIFY_TAG" => "CRM|LEAD_PROGRESS|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_LEAD_PROGRESS_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>", "#start_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['START_STATUS_ID']]['NAME']), "#final_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['FINAL_STATUS_ID']]['NAME']))), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_LEAD_PROGRESS_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']), "#start_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['START_STATUS_ID']]['NAME']), "#final_status_title#" => htmlspecialcharsbx($infos[$sonetEventFields['PARAMS']['FINAL_STATUS_ID']]['NAME']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
}
}
unset($sonetEventFields);
}
unset($sonetEvent);
}
if ($bResult) {
$afterEvents = GetModuleEvents('crm', 'OnAfterCrmLeadUpdate');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
}
}
return $bResult;
}
示例8: PrepareClientInfoV2
public static function PrepareClientInfoV2($arParams)
{
$showUrl = isset($arParams['SHOW_URL']) ? $arParams['SHOW_URL'] : '';
if ($showUrl === '') {
$entityTypeID = isset($arParams['ENTITY_TYPE_ID']) ? intval($arParams['ENTITY_TYPE_ID']) : 0;
$entityID = isset($arParams['ENTITY_ID']) ? intval($arParams['ENTITY_ID']) : 0;
if ($entityTypeID > 0 && $entityID > 0) {
$showUrl = CCrmOwnerType::GetShowUrl($entityTypeID, $entityID);
}
}
$photoID = isset($arParams['PHOTO_ID']) ? intval($arParams['PHOTO_ID']) : 0;
$photoUrl = $photoID > 0 ? CFile::ResizeImageGet($photoID, array('width' => 30, 'height' => 30), BX_RESIZE_IMAGE_EXACT) : '';
$name = isset($arParams['NAME']) ? $arParams['NAME'] : '';
$description = isset($arParams['DESCRIPTION']) ? $arParams['DESCRIPTION'] : '';
$html = isset($arParams['ADDITIONAL_HTML']) ? $arParams['ADDITIONAL_HTML'] : '';
if ($showUrl !== '') {
return '<a class="crm-item-client-block" href="' . htmlspecialcharsbx($showUrl) . '"><div class="crm-item-client-img">' . (isset($photoUrl['src']) ? '<img alt="" src="' . htmlspecialcharsbx($photoUrl['src']) . '"/>' : '') . '</div>' . '<span class="crm-item-client-alignment"></span>' . '<span class="crm-item-client-alignment-block">' . '<div class="crm-item-client-name">' . htmlspecialcharsbx($name) . '</div><div class="crm-item-client-description">' . htmlspecialcharsbx($description) . $html . '</div></span></a>';
}
return '<span class="crm-item-client-block"><div class="crm-item-client-img">' . (isset($photoUrl['src']) ? '<img alt="" src="' . htmlspecialcharsbx($photoUrl['src']) . '"/>' : '') . '</div>' . '<span class="crm-item-client-alignment"></span>' . '<span class="crm-item-client-alignment-block">' . '<div class="crm-item-client-name">' . htmlspecialcharsbx($name) . '</div><div class="crm-item-client-description">' . htmlspecialcharsbx($description) . $html . '</div></span></span>';
}
示例9: Update
//.........这里部分代码省略.........
$DB->Query("UPDATE b_crm_company SET {$sUpdate} WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
$bResult = true;
$newTitle = isset($arFields['TITLE']) ? $arFields['TITLE'] : '';
$oldTitle = isset($arRow['TITLE']) ? $arRow['TITLE'] : '';
if ($newTitle !== '' && $newTitle !== $oldTitle) {
\Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::register(CCrmOwnerType::Company, $ID, $newTitle);
}
}
if (defined("BX_COMP_MANAGED_CACHE")) {
static $arNameFields = array("TITLE");
$bClear = false;
foreach ($arNameFields as $val) {
if (isset($arFields[$val])) {
$bClear = true;
break;
}
}
if ($bClear) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Company . "_" . $ID);
}
}
CCrmPerms::UpdateEntityAttr('COMPANY', $ID, $arEntityAttr);
CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
$GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
if (isset($arFields['FM']) && is_array($arFields['FM'])) {
$CCrmFieldMulti = new CCrmFieldMulti();
$CCrmFieldMulti->SetFields('COMPANY', $ID, $arFields['FM']);
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'EMAIL', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'EMAIL'));
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'PHONE', \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'PHONE'));
}
\Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Company, $ID, array_merge($arRow, $arFields));
if ($bUpdateSearch) {
CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'COMPANY', true);
}
$arFields['ID'] = $ID;
if (isset($arFields['CONTACT_ID']) && is_array($arFields['CONTACT_ID'])) {
if (!empty($arFields['CONTACT_ID'])) {
$arCurrentContact = array();
$res = CCrmContact::GetContactByCompanyId($arFields['ID']);
while ($ar = $res->Fetch()) {
$arCurrentContact[] = $ar['ID'];
}
$arAdd = array_diff($arFields['CONTACT_ID'], $arCurrentContact);
$arDelete = array_diff($arCurrentContact, $arFields['CONTACT_ID']);
$CCrmContact = new CCrmContact();
$CCrmContact->UpdateCompanyId($arAdd, $arFields['ID']);
$CCrmContact->UpdateCompanyId($arDelete, 0);
if (isset($GLOBALS["USER"])) {
if (!class_exists('CUserOptions')) {
include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
}
CUserOptions::SetOption("crm", "crm_contact_search", array('last_selected' => implode(',', $arAdd)));
}
} else {
$arDelete = array();
$res = CCrmContact::GetContactByCompanyId($arFields['ID']);
while ($ar = $res->Fetch()) {
$arDelete[] = $ar['ID'];
}
$CCrmContact = new CCrmContact();
$CCrmContact->UpdateCompanyId($arDelete, 0);
}
}
$registerSonetEvent = isset($options['REGISTER_SONET_EVENT']) && $options['REGISTER_SONET_EVENT'] === true;
if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Company, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
}
if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
$modifiedByID = intval($arFields['MODIFY_BY_ID']);
foreach ($sonetEventData as &$sonetEvent) {
$sonetEventFields =& $sonetEvent['FIELDS'];
$sonetEventFields['ENTITY_TYPE_ID'] = CCrmOwnerType::Company;
$sonetEventFields['ENTITY_ID'] = $ID;
$sonetEventFields['USER_ID'] = $modifiedByID;
$logEventID = CCrmLiveFeed::CreateLogEvent($sonetEventFields, $sonetEvent['TYPE']);
if ($logEventID && $sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible && CModule::IncludeModule("im")) {
$url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $ID);
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
if ($sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "company_update", "NOTIFY_TAG" => "CRM|COMPANY_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_COMPANY_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_COMPANY_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
if ($sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "company_update", "NOTIFY_TAG" => "CRM|COMPANY_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_COMPANY_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['TITLE']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_COMPANY_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['TITLE']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
}
unset($sonetEventFields);
}
unset($sonetEvent);
}
if ($bResult) {
$afterEvents = GetModuleEvents('crm', 'OnAfterCrmCompanyUpdate');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
}
}
return $bResult;
}
示例10: findByPhoneNumber
public static function findByPhoneNumber($number, $params = array())
{
if (!is_string($number)) {
throw new \Bitrix\Main\ArgumentTypeException('number', 'string');
}
if ($number === '') {
throw new \Bitrix\Main\ArgumentException('Is empty', 'number');
}
if (!is_array($params)) {
$params = array();
}
$userID = isset($params['USER_ID']) ? intval($params['USER_ID']) : 0;
if ($userID <= 0) {
$userID = CCrmPerms::GetCurrentUserID();
}
$isAdmin = CCrmPerms::IsAdmin($userID);
$userPermissions = CCrmPerms::GetUserPermissions($userID);
$enableExtendedMode = isset($params['ENABLE_EXTENDED_MODE']) ? (bool) $params['ENABLE_EXTENDED_MODE'] : true;
$contactFormID = isset($params['CONTACT_FORM_ID']) ? intval($params['CONTACT_FORM_ID']) : '';
if ($contactFormID === '') {
$contactFormID = CCrmContact::DEFAULT_FORM_ID;
}
$dups = array();
$criterion = new \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion('PHONE', $number);
$entityTypes = array(CCrmOwnerType::Contact, CCrmOwnerType::Company, CCrmOwnerType::Lead);
foreach ($entityTypes as $entityType) {
$duplicate = $criterion->find($entityType, 1);
if ($duplicate !== null) {
$dups[] = $duplicate;
}
}
$entityByType = array();
foreach ($dups as &$dup) {
/** @var \Bitrix\Crm\Integrity\Duplicate $dup */
$entities = $dup->getEntities();
if (!(is_array($entities) && !empty($entities))) {
continue;
}
//Each entity type limited by 50 items
foreach ($entities as &$entity) {
/** @var \Bitrix\Crm\Integrity\DuplicateEntity $entity */
$entityTypeID = $entity->getEntityTypeID();
$entityID = $entity->getEntityID();
$fields = null;
if ($entityTypeID === CCrmOwnerType::Contact) {
$dbEntity = CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO', 'POST', 'COMPANY_ID', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
$entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
if (is_array($entityFields)) {
$formattedName = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
$fields = array('ID' => intval($entityFields['ID']), 'FORMATTED_NAME' => $formattedName, 'PHOTO' => isset($entityFields['PHOTO']) ? intval($entityFields['PHOTO']) : 0, 'COMPANY_ID' => isset($entityFields['COMPANY_ID']) ? intval($entityFields['COMPANY_ID']) : 0, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmContact::CheckReadPermission($entityID, $userPermissions));
if ($fields['CAN_READ'] && $enableExtendedMode) {
$deals = array();
$dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=CONTACT_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
if (is_object($dbDeal)) {
while ($dealFields = $dbDeal->Fetch()) {
$dealID = intval($dealFields['ID']);
//$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
$dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
$deals[] = $dealFields;
}
}
$fields['DEALS'] =& $deals;
unset($deals);
}
}
} elseif ($entityTypeID === CCrmOwnerType::Company) {
$dbEntity = CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'LOGO', 'ASSIGNED_BY_ID'));
$entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
if (is_array($entityFields)) {
$fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'LOGO' => isset($entityFields['LOGO']) ? intval($entityFields['LOGO']) : 0, 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmCompany::CheckReadPermission($entityID, $userPermissions));
if ($fields['CAN_READ'] && $enableExtendedMode) {
$deals = array();
$dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=COMPANY_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
if (is_object($dbDeal)) {
while ($dealFields = $dbDeal->Fetch()) {
$dealID = intval($dealFields['ID']);
//$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
$dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
$deals[] = $dealFields;
}
}
$fields['DEALS'] =& $deals;
unset($deals);
}
}
} elseif ($entityTypeID === CCrmOwnerType::Lead) {
$dbEntity = CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'POST', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
$entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
if (is_array($entityFields)) {
$formattedName = '';
if (!empty($entityFields['NAME']) || !empty($entityFields['SECOND_NAME']) || !empty($entityFields['LAST_NAME'])) {
$formattedName = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
}
$fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'FORMATTED_NAME' => $formattedName, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmLead::CheckReadPermission($entityID, $userPermissions));
}
}
if (!is_array($fields)) {
continue;
}
if ($fields['CAN_READ'] && $enableExtendedMode) {
//.........这里部分代码省略.........
示例11: Update
//.........这里部分代码省略.........
\Bitrix\Crm\EntityAddress::register(CCrmOwnerType::Contact, $ID, \Bitrix\Crm\EntityAddress::Primary, array('ADDRESS_1' => isset($arFields['ADDRESS']) ? $arFields['ADDRESS'] : (isset($arRow['ADDRESS']) ? $arRow['ADDRESS'] : null), 'ADDRESS_2' => isset($arFields['ADDRESS_2']) ? $arFields['ADDRESS_2'] : (isset($arRow['ADDRESS_2']) ? $arRow['ADDRESS_2'] : null), 'CITY' => isset($arFields['ADDRESS_CITY']) ? $arFields['ADDRESS_CITY'] : (isset($arRow['ADDRESS_CITY']) ? $arRow['ADDRESS_CITY'] : null), 'POSTAL_CODE' => isset($arFields['ADDRESS_POSTAL_CODE']) ? $arFields['ADDRESS_POSTAL_CODE'] : (isset($arRow['ADDRESS_POSTAL_CODE']) ? $arRow['ADDRESS_POSTAL_CODE'] : null), 'REGION' => isset($arFields['ADDRESS_REGION']) ? $arFields['ADDRESS_REGION'] : (isset($arRow['ADDRESS_REGION']) ? $arRow['ADDRESS_REGION'] : null), 'PROVINCE' => isset($arFields['ADDRESS_PROVINCE']) ? $arFields['ADDRESS_PROVINCE'] : (isset($arRow['ADDRESS_PROVINCE']) ? $arRow['ADDRESS_PROVINCE'] : null), 'COUNTRY' => isset($arFields['ADDRESS_COUNTRY']) ? $arFields['ADDRESS_COUNTRY'] : (isset($arRow['ADDRESS_COUNTRY']) ? $arRow['ADDRESS_COUNTRY'] : null), 'COUNTRY_CODE' => isset($arFields['ADDRESS_COUNTRY_CODE']) ? $arFields['ADDRESS_COUNTRY_CODE'] : (isset($arRow['ADDRESS_COUNTRY_CODE']) ? $arRow['ADDRESS_COUNTRY_CODE'] : null)));
}
CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => false));
$GLOBALS['USER_FIELD_MANAGER']->Update(self::$sUFEntityID, $ID, $arFields);
if (defined("BX_COMP_MANAGED_CACHE")) {
static $arNameFields = array("NAME", "LAST_NAME", "SECOND_NAME");
$bClear = false;
foreach ($arNameFields as $val) {
if (isset($arFields[$val])) {
$bClear = true;
break;
}
}
if ($bClear) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Contact . "_" . $ID);
}
}
if (isset($arFields['FM']) && is_array($arFields['FM'])) {
$CCrmFieldMulti = new CCrmFieldMulti();
$CCrmFieldMulti->SetFields(CCrmOwnerType::ContactName, $ID, $arFields['FM']);
$multifields = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::prepareEntityMultifieldsValues(CCrmOwnerType::Contact, $ID);
$emails = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'EMAIL');
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Contact, $ID, 'EMAIL', $emails);
$phones = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($multifields, 'PHONE');
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Contact, $ID, 'PHONE', $phones);
$hasEmail = empty($emails) ? 'N' : 'Y';
$hasPhone = empty($phones) ? 'N' : 'Y';
if ($hasEmail !== (isset($arRow['HAS_EMAIL']) ? $arRow['HAS_EMAIL'] : 'N') || $hasPhone !== (isset($arRow['HAS_PHONE']) ? $arRow['HAS_PHONE'] : 'N')) {
$DB->Query("UPDATE b_crm_contact SET HAS_EMAIL = '{$hasEmail}', HAS_PHONE = '{$hasPhone}' WHERE ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
$arFields['HAS_EMAIL'] = $hasEmail;
$arFields['HAS_PHONE'] = $hasPhone;
}
}
\Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Contact, $ID, array_merge($arRow, $arFields));
if ($bUpdateSearch) {
CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'CONTACT', true);
}
if (isset($GLOBALS["USER"]) && isset($arFields['COMPANY_ID']) && intval($arFields['COMPANY_ID']) > 0) {
if (!class_exists('CUserOptions')) {
include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
}
CUserOptions::SetOption("crm", "crm_company_search", array('last_selected' => $arFields['COMPANY_ID']));
}
$arFields['ID'] = $ID;
$newCompanyID = isset($arFields['COMPANY_ID']) ? intval($arFields['COMPANY_ID']) : 0;
$oldCompanyID = isset($arRow['COMPANY_ID']) ? intval($arRow['COMPANY_ID']) : 0;
$companyID = $newCompanyID > 0 ? $newCompanyID : $oldCompanyID;
$registerSonetEvent = isset($arOptions['REGISTER_SONET_EVENT']) && $arOptions['REGISTER_SONET_EVENT'] === true;
if ($bResult && isset($arFields['ASSIGNED_BY_ID'])) {
CCrmSonetSubscription::ReplaceSubscriptionByEntity(CCrmOwnerType::Contact, $ID, CCrmSonetSubscriptionType::Responsibility, $arFields['ASSIGNED_BY_ID'], $arRow['ASSIGNED_BY_ID'], $registerSonetEvent);
}
if ($bResult && $bCompare && $registerSonetEvent && !empty($sonetEventData)) {
$modifiedByID = intval($arFields['MODIFY_BY_ID']);
foreach ($sonetEventData as &$sonetEvent) {
$sonetEventType = $sonetEvent['TYPE'];
$sonetEventCode = isset($sonetEvent['CODE']) ? $sonetEvent['CODE'] : '';
$sonetEventFields =& $sonetEvent['FIELDS'];
$sonetEventFields['ENTITY_TYPE_ID'] = CCrmOwnerType::Contact;
$sonetEventFields['ENTITY_ID'] = $ID;
$sonetEventFields['USER_ID'] = $modifiedByID;
//Register company relation
if ($sonetEventCode === 'COMPANY') {
//If company changed bind events to old and new companies
$sonetEventFields['PARENTS'] = array();
if ($oldCompanyID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $oldCompanyID);
}
if ($newCompanyID > 0) {
$sonetEventFields['PARENTS'][] = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $newCompanyID);
}
} elseif ($companyID > 0) {
$sonetEventFields['PARENT_ENTITY_TYPE_ID'] = CCrmOwnerType::Company;
$sonetEventFields['PARENT_ENTITY_ID'] = $companyID;
}
$logEventID = CCrmLiveFeed::CreateLogEvent($sonetEventFields, $sonetEventType);
if ($logEventID && $sonetEvent['TYPE'] == CCrmLiveFeedEvent::Responsible && CModule::IncludeModule("im")) {
$url = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Contact, $ID);
$serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0 ? SITE_SERVER_NAME : COption::GetOptionString("main", "server_name", ""));
if ($sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['FINAL_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "contact_update", "NOTIFY_TAG" => "CRM|CONTACT_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_CONTACT_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['FULL_NAME']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_CONTACT_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['FULL_NAME']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
if ($sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'] != $modifiedByID) {
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $sonetEventFields['PARAMS']['START_RESPONSIBLE_ID'], "FROM_USER_ID" => $modifiedByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "contact_update", "NOTIFY_TAG" => "CRM|CONTACT_RESPONSIBLE|" . $ID, "NOTIFY_MESSAGE" => GetMessage("CRM_CONTACT_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => "<a href=\"" . $url . "\" class=\"bx-notifier-item-action\">" . htmlspecialcharsbx($arFields['FULL_NAME']) . "</a>")), "NOTIFY_MESSAGE_OUT" => GetMessage("CRM_CONTACT_NOT_RESPONSIBLE_IM_NOTIFY", array("#title#" => htmlspecialcharsbx($arFields['FULL_NAME']))) . " (" . $serverName . $url . ")");
CIMNotify::Add($arMessageFields);
}
}
unset($sonetEventFields);
}
unset($sonetEvent);
}
if ($bResult) {
$afterEvents = GetModuleEvents('crm', 'OnAfterCrmContactUpdate');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
}
}
return $bResult;
}
示例12: isset
$responsibleUrl = isset($item['PATH_TO_RESPONSIBLE']) ? $item['PATH_TO_RESPONSIBLE'] : '';
if ($responsibleUrl === '') {
$responsibleUrl = CComponentEngine::MakePathFromTemplate($arResult['PATH_TO_USER_PROFILE'], array('user_id' => $responsibleID));
}
$editorItem = array('ID' => $item['~ID'], 'typeID' => $item['~TYPE_ID'], 'subject' => $item['~SUBJECT'], 'description' => isset($item['DESCRIPTION_RAW']) ? $item['DESCRIPTION_RAW'] : '', 'descriptionHtml' => isset($item['DESCRIPTION_HTML']) ? $item['DESCRIPTION_HTML'] : '', 'direction' => intval($item['~DIRECTION']), 'location' => $item['~LOCATION'], 'start' => isset($item['~START_TIME']) ? ConvertTimeStamp(MakeTimeStamp($item['~START_TIME']), 'FULL', SITE_ID) : '', 'end' => isset($item['~END_TIME']) ? ConvertTimeStamp(MakeTimeStamp($item['~END_TIME']), 'FULL', SITE_ID) : '', 'deadline' => isset($item['~DEADLINE']) ? ConvertTimeStamp(MakeTimeStamp($item['~DEADLINE']), 'FULL', SITE_ID) : '', 'completed' => $item['~COMPLETED'] == 'Y', 'notifyType' => intval($item['~NOTIFY_TYPE']), 'notifyValue' => intval($item['~NOTIFY_VALUE']), 'priority' => intval($item['~PRIORITY']), 'responsibleID' => $responsibleID, 'responsibleName' => isset($item['~RESPONSIBLE_FULL_NAME'][0]) ? $item['~RESPONSIBLE_FULL_NAME'] : GetMessage('CRM_UNDEFINED_VALUE'), 'responsibleUrl' => $responsibleUrl, 'storageTypeID' => intval($item['STORAGE_TYPE_ID']), 'files' => $item['FILES'], 'webdavelements' => $item['WEBDAV_ELEMENTS'], 'diskfiles' => $item['DISK_FILES'], 'associatedEntityID' => isset($item['~ASSOCIATED_ENTITY_ID']) ? intval($item['~ASSOCIATED_ENTITY_ID']) : 0);
if (!$commLoaded) {
$editorItem['communicationsLoaded'] = false;
} else {
$editorItem['communicationsLoaded'] = true;
$editorItem['communications'] = $commData;
}
if (isset($item['OWNER_TYPE_ID']) && isset($item['OWNER_ID'])) {
$editorItem['ownerType'] = CCrmOwnerType::ResolveName($item['OWNER_TYPE_ID']);
$editorItem['ownerID'] = $item['OWNER_ID'];
$editorItem['ownerTitle'] = CCrmOwnerType::GetCaption($item['OWNER_TYPE_ID'], $item['OWNER_ID']);
$editorItem['ownerUrl'] = CCrmOwnerType::GetShowUrl($item['OWNER_TYPE_ID'], $item['OWNER_ID']);
}
$editorItems[] = $editorItem;
// <-- Preparing activity editor item
}
unset($item);
if ($arResult['NEED_FOR_CONVERTING_OF_CALENDAR_EVENTS']) {
?>
<div class="crm-view-message"><?php
echo GetMessage('CRM_ACTION_CONVERTING_OF_CALENDAR_EVENTS', array('#URL_EXECUTE_CONVERTING#' => htmlspecialcharsbx($arResult['CAL_EVENT_CONV_EXEC_URL']), '#URL_SKIP_CONVERTING#' => htmlspecialcharsbx($arResult['CAL_EVENT_CONV_SKIP_URL'])));
?>
</div><?php
}
if ($arResult['NEED_FOR_CONVERTING_OF_TASKS']) {
?>
<div class="crm-view-message"><?php
示例13: GetMessage
break;
case CTaskColumnList::COLUMN_PRIORITY:
echo GetMessage('TASKS_LIST_ITEMS_PRIORITY_' . $task['PRIORITY']);
break;
case CTaskColumnList::COLUMN_UF_CRM:
if (empty($task['UF_CRM_TASK'])) {
break;
}
$collection = array();
sort($task['UF_CRM_TASK']);
foreach ($task['UF_CRM_TASK'] as $value) {
$crmElement = explode('_', $value);
$type = $crmElement[0];
$typeId = CCrmOwnerType::ResolveID(CCrmOwnerTypeAbbr::ResolveName($type));
$title = CCrmOwnerType::GetCaption($typeId, $crmElement[1]);
$url = CCrmOwnerType::GetShowUrl($typeId, $crmElement[1]);
if (!isset($collection[$type])) {
$collection[$type] = array();
}
$collection[$type][] = '<a href="' . $url . '">' . $title . '</a>';
}
if ($collection) {
echo '<div class="tasks-list-crm-div">';
$prevType = null;
foreach ($collection as $type => $items) {
if ($type !== $prevType) {
if ($prevType !== null) {
echo ' ';
}
echo '<span class="tasks-list-crm-div-type">' . GetMessage('TASKS_LIST_CRM_TYPE_' . $type) . ':</span>';
}
示例14: isset
$arParams['NAME_FORMAT'] = isset($arParams['NAME_FORMAT']) ? $arParams['NAME_FORMAT'] : '';
$arResult['NAME_FORMAT'] = $arParams['NAME_FORMAT'] !== '' ? $arParams['NAME_FORMAT'] : \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
$utils = new CComponentUtil();
$arParams['DATE_FORMAT'] = isset($arParams['DATE_FORMAT']) ? $arParams['DATE_FORMAT'] : '';
$arResult['DATE_FORMAT'] = $arParams['DATE_FORMAT'] !== '' ? $arParams['DATE_FORMAT'] : $utils->GetDateFormatDefault(true);
$arParams['INTERVAL_IN_DAYS'] = isset($arParams['INTERVAL_IN_DAYS']) ? (int) $arParams['INTERVAL_IN_DAYS'] : 7;
$intervalInDays = $arParams['INTERVAL_IN_DAYS'] > 0 ? $arParams['INTERVAL_IN_DAYS'] : 7;
$arParams['CHECK_PERMISSIONS'] = isset($arParams['CHECK_PERMISSIONS']) ? strtoupper($arParams['CHECK_PERMISSIONS']) : 'Y';
$enablePermissionCheck = $arParams['CHECK_PERMISSIONS'] !== 'N';
$arParams['LIMIT'] = isset($arParams['LIMIT']) ? (int) $arParams['LIMIT'] : 5;
$limit = $arParams['LIMIT'] > 0 ? $arParams['LIMIT'] : 5;
$currentDate = ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT', SITE_ID);
$items = array();
if ($canReadLead) {
$items = array_merge(BirthdayReminder::getNearestEntities(\CCrmOwnerType::Lead, $currentDate, '', $intervalInDays, $enablePermissionCheck, $limit), $items);
}
if ($canReadContact) {
$items = array_merge(BirthdayReminder::getNearestEntities(\CCrmOwnerType::Contact, $currentDate, '', $intervalInDays, $enablePermissionCheck, $limit), $items);
}
sortByColumn($items, 'BIRTHDAY_SORT');
if (count($items) > $limit) {
$items = array_slice($items, 0, $limit);
}
foreach ($items as &$item) {
$item['SHOW_URL'] = \CCrmOwnerType::GetShowUrl($item['ENTITY_TYPE_ID'], $item['ID'], $enablePermissionCheck);
}
unset($item);
if (!empty($items)) {
$arResult['ITEMS'] = $items;
$this->IncludeComponentTemplate();
}
示例15: __CrmActivityListRenderItems
//.........这里部分代码省略.........
<td><?php
echo htmlspecialcharsbx(GetMessage('CRM_ACTIVITY_ROW_COL_TTL_RESPONSIBLE'));
?>
</td>
</tr>
</thead>
<tbody>
<?php
$processed = 0;
for ($i = 0; $i < $count; $i++) {
$item =& $items[$i];
if ($showMode == 'NOT_COMPLETED' && $item['COMPLETED'] == 'Y' || $showMode == 'COMPLETED' && $item['COMPLETED'] == 'N') {
continue;
}
$processed++;
$commData = array();
if (isset($item['COMMUNICATIONS'])) {
foreach ($item['COMMUNICATIONS'] as &$arComm) {
CCrmActivity::PrepareCommunicationInfo($arComm);
$commData[] = array('id' => $arComm['ID'], 'type' => $arComm['TYPE'], 'value' => $arComm['VALUE'], 'entityId' => $arComm['ENTITY_ID'], 'entityType' => CCrmOwnerType::ResolveName($arComm['ENTITY_TYPE_ID']), 'entityTitle' => $arComm['TITLE']);
}
unset($arComm);
}
$rowID = $editorCfg['PREFIX'];
if ($rowID !== '') {
$rowID .= '_';
}
$rowID .= '_row_' . strval($processed);
$editorItem = array('ID' => $item['~ID'], 'rowID' => $rowID, 'typeID' => $item['~TYPE_ID'], 'subject' => strval($item['~SUBJECT']), 'description' => strval($item['~DESCRIPTION']), 'direction' => intval($item['~DIRECTION']), 'location' => strval($item['~LOCATION']), 'start' => isset($item['~START_TIME']) ? ConvertTimeStamp(MakeTimeStamp($item['~START_TIME']), 'FULL', SITE_ID) : '', 'end' => isset($item['~END_TIME']) ? ConvertTimeStamp(MakeTimeStamp($item['~END_TIME']), 'FULL', SITE_ID) : '', 'deadline' => isset($item['~DEADLINE']) ? ConvertTimeStamp(MakeTimeStamp($item['~DEADLINE']), 'FULL', SITE_ID) : '', 'completed' => strval($item['~COMPLETED']) == 'Y', 'notifyType' => intval($item['~NOTIFY_TYPE']), 'notifyValue' => intval($item['~NOTIFY_VALUE']), 'priority' => intval($item['~PRIORITY']), 'responsibleID' => isset($item['~RESPONSIBLE_ID'][0]) ? intval($item['~RESPONSIBLE_ID']) : 0, 'responsibleName' => isset($item['~RESPONSIBLE_FULL_NAME'][0]) ? $item['~RESPONSIBLE_FULL_NAME'] : GetMessage('CRM_UNDEFINED_VALUE'), 'storageTypeID' => intval($item['STORAGE_TYPE_ID']), 'files' => $item['FILES'], 'webdavelements' => $item['WEBDAV_ELEMENTS'], 'associatedEntityID' => isset($item['~ASSOCIATED_ENTITY_ID']) ? intval($item['~ASSOCIATED_ENTITY_ID']) : 0, 'communications' => $commData);
if (isset($item['OWNER_TYPE_ID']) && isset($item['OWNER_ID'])) {
$editorItem['ownerType'] = CCrmOwnerType::ResolveName($item['OWNER_TYPE_ID']);
$editorItem['ownerID'] = $item['OWNER_ID'];
$editorItem['ownerTitle'] = CCrmOwnerType::GetCaption($item['OWNER_TYPE_ID'], $item['OWNER_ID']);
$editorItem['ownerUrl'] = CCrmOwnerType::GetShowUrl($item['OWNER_TYPE_ID'], $item['OWNER_ID']);
}
$editorItems[] = $editorItem;
$rowClass = 'crm-activity-row';
if ($processed % 2 === 0) {
$rowClass .= ' crm-activity-row-even';
}
if (intval($item['~PRIORITY']) === CCrmActivityPriority::High) {
$rowClass .= ' crm-activity-row-important';
}
?>
<tr id="<?php
echo htmlspecialcharsbx($rowID);
?>
" class="<?php
echo htmlspecialcharsbx($rowClass);
?>
" style="<?php
echo $showTop > 0 && $processed > $showTop ? 'display:none;' : '';
?>
">
<td><!--Delete-->
<?php
if (!$arResult['READ_ONLY']) {
?>
<span class="crm-view-table-column-delete"></span>
<?php
}
?>
</td>
<td> <!--Type-->
<a class="crm-activity-type" href="#"><?php
echo $item['TYPE_NAME'];