本文整理汇总了PHP中CCrmContact::GetContactByCompanyId方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::GetContactByCompanyId方法的具体用法?PHP CCrmContact::GetContactByCompanyId怎么用?PHP CCrmContact::GetContactByCompanyId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmContact
的用法示例。
在下文中一共展示了CCrmContact::GetContactByCompanyId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: array
}
}
$arResult['FORM_ID'] = !empty($arParams['FORM_ID']) ? $arParams['FORM_ID'] : 'CRM_COMPANY_EDIT_V12';
$arResult['GRID_ID'] = 'CRM_COMPANY_LIST_V12';
$arResult['BACK_URL'] = $arParams['PATH_TO_COMPANY_LIST'];
$arResult['COMPANY_TYPE_LIST'] = CCrmStatus::GetStatusList('COMPANY_TYPE');
$arResult['INDUSTRY_LIST'] = CCrmStatus::GetStatusList('INDUSTRY');
$arResult['CURRENCY_LIST'] = CCrmCurrencyHelper::PrepareListItems();
$arResult['EMPLOYEES_LIST'] = CCrmStatus::GetStatusList('EMPLOYEES');
$arResult['EDIT'] = $bEdit;
$arResult['IS_COPY'] = $bCopy;
$arResult['DUPLICATE_CONTROL'] = array();
$enableDupControl = $arResult['DUPLICATE_CONTROL']['ENABLED'] = !$bEdit && \Bitrix\Crm\Integrity\DuplicateControl::isControlEnabledFor(CCrmOwnerType::Company);
// Fix for #26945. Suppress binding of contacts to new compnany. Contacts will be binded to source company.
if (!$bCopy) {
$dbRes = CCrmContact::GetContactByCompanyId($arResult['ELEMENT']['ID']);
if (!isset($arResult['CONTACT_ID'])) {
$arResult['CONTACT_ID'] = array();
}
while ($arContact = $dbRes->Fetch()) {
$arResult['CONTACT_ID'][] = $arContact['ID'];
}
}
$arResult['FIELDS'] = array();
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_company_info', 'name' => GetMessage('CRM_SECTION_COMPANY_INFO2'), 'type' => 'section');
$titleID = $arResult['FORM_ID'] . '_TITLE';
$titleCaptionID = $arResult['FORM_ID'] . '_TITLE_CAP';
if ($enableDupControl) {
$arResult['DUPLICATE_CONTROL']['TITLE_ID'] = $titleID;
$arResult['DUPLICATE_CONTROL']['TITLE_CAPTION_ID'] = $titleCaptionID;
}