本文整理汇总了PHP中CCrmFieldMulti::ExtractValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmFieldMulti::ExtractValues方法的具体用法?PHP CCrmFieldMulti::ExtractValues怎么用?PHP CCrmFieldMulti::ExtractValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmFieldMulti
的用法示例。
在下文中一共展示了CCrmFieldMulti::ExtractValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Add
//.........这里部分代码省略.........
if ($sEntityPerm == BX_CRM_PERM_NONE) {
$this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED');
$arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
return false;
}
$assignedByID = intval($arFields['ASSIGNED_BY_ID']);
if ($sEntityPerm == BX_CRM_PERM_SELF && $assignedByID != $iUserId) {
$arFields['ASSIGNED_BY_ID'] = $iUserId;
}
if ($sEntityPerm == BX_CRM_PERM_OPEN && $iUserId == $assignedByID) {
$arFields['OPENED'] = 'Y';
}
}
$assignedByID = intval($arFields['ASSIGNED_BY_ID']);
$arEntityAttr = self::BuildEntityAttr($assignedByID, $arAttr);
$userPerms = $assignedByID == CCrmPerms::GetCurrentUserID() ? $this->cPerms : CCrmPerms::GetUserPermissions($assignedByID);
$sEntityPerm = $userPerms->GetPermType('COMPANY', $sPermission, $arEntityAttr);
$this->PrepareEntityAttrs($arEntityAttr, $sEntityPerm);
if (isset($arFields['LOGO']) && is_array($arFields['LOGO']) && strlen(CFile::CheckImageFile($arFields['LOGO'])) === 0) {
$arFields['LOGO']['MODULE_ID'] = 'crm';
CFile::SaveForDB($arFields, 'LOGO', 'crm');
}
$beforeEvents = GetModuleEvents('crm', 'OnBeforeCrmCompanyAdd');
while ($arEvent = $beforeEvents->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array(&$arFields)) === false) {
if (isset($arFields['RESULT_MESSAGE'])) {
$this->LAST_ERROR = $arFields['RESULT_MESSAGE'];
} else {
$this->LAST_ERROR = GetMessage('CRM_COMPANY_CREATION_CANCELED', array('#NAME#' => $arEvent['TO_NAME']));
$arFields['RESULT_MESSAGE'] =& $this->LAST_ERROR;
}
return false;
}
}
$ID = intval($DB->Add('b_crm_company', $arFields, array(), 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__));
$result = $arFields['ID'] = $ID;
CCrmPerms::UpdateEntityAttr('COMPANY', $ID, $arEntityAttr);
\Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::register(CCrmOwnerType::Company, $ID, $arFields['TITLE']);
CCrmEntityHelper::NormalizeUserFields($arFields, self::$sUFEntityID, $GLOBALS['USER_FIELD_MANAGER'], array('IS_NEW' => true));
$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']);
$emails = \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'EMAIL');
if (!empty($emails)) {
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'EMAIL', $emails);
}
$phones = Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::extractMultifieldsValues($arFields['FM'], 'PHONE');
if (!empty($phones)) {
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::register(CCrmOwnerType::Company, $ID, 'PHONE', $phones);
}
}
\Bitrix\Crm\Integrity\DuplicateEntityRanking::registerEntityStatistics(CCrmOwnerType::Company, $ID, $arFields);
if ($bUpdateSearch) {
CCrmSearch::UpdateSearch(array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), 'COMPANY', true);
}
if (isset($arFields['CONTACT_ID']) && is_array($arFields['CONTACT_ID'])) {
$CCrmContact = new CCrmContact();
$CCrmContact->UpdateCompanyId($arFields['CONTACT_ID'], $arFields['ID']);
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(',', $arFields['CONTACT_ID'])));
}
}
if (isset($options['REGISTER_SONET_EVENT']) && $options['REGISTER_SONET_EVENT'] === true) {
$revenue = round(isset($arFields['REVENUE']) ? doubleval($arFields['REVENUE']) : 0.0, 2);
$currencyID = isset($arFields['CURRENCY_ID']) ? $arFields['CURRENCY_ID'] : '';
if ($currencyID === '') {
$currencyID = CCrmCurrency::GetBaseCurrencyID();
}
$multiFields = isset($arFields['FM']) ? $arFields['FM'] : null;
$phones = CCrmFieldMulti::ExtractValues($multiFields, 'PHONE');
$emails = CCrmFieldMulti::ExtractValues($multiFields, 'EMAIL');
$assignedByID = intval($arFields['ASSIGNED_BY_ID']);
$createdByID = intval($arFields['CREATED_BY_ID']);
$liveFeedFields = array('USER_ID' => $createdByID, 'ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $ID, 'TITLE' => GetMessage('CRM_COMPANY_EVENT_ADD'), 'MESSAGE' => '', 'PARAMS' => array('TITLE' => $arFields['TITLE'], 'LOGO_ID' => isset($arFields['LOGO']) ? $arFields['LOGO'] : '', 'TYPE' => isset($arFields['COMPANY_TYPE']) ? $arFields['COMPANY_TYPE'] : '', 'REVENUE' => strval($revenue), 'CURRENCY_ID' => $currencyID, 'PHONES' => $phones, 'EMAILS' => $emails, 'AUTHOR_ID' => intval($arFields['CREATED_BY_ID']), 'RESPONSIBLE_ID' => $assignedByID));
CCrmSonetSubscription::RegisterSubscription(CCrmOwnerType::Company, $ID, CCrmSonetSubscriptionType::Responsibility, $assignedByID);
$logEventID = CCrmLiveFeed::CreateLogEvent($liveFeedFields, CCrmLiveFeedEvent::Add);
if ($logEventID && $assignedByID != $createdByID && 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", ""));
$arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $assignedByID, "FROM_USER_ID" => $createdByID, "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "crm", "LOG_ID" => $logEventID, "NOTIFY_EVENT" => "company_add", "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);
}
}
$afterEvents = GetModuleEvents('crm', 'OnAfterCrmCompanyAdd');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
if (isset($arFields['ORIGIN_ID']) && $arFields['ORIGIN_ID'] !== '') {
$afterEvents = GetModuleEvents('crm', 'OnAfterExternalCrmCompanyAdd');
while ($arEvent = $afterEvents->Fetch()) {
ExecuteModuleEventEx($arEvent, array(&$arFields));
}
}
}
return $result;
}