本文整理汇总了PHP中CCrmCompany::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmCompany::GetList方法的具体用法?PHP CCrmCompany::GetList怎么用?PHP CCrmCompany::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmCompany
的用法示例。
在下文中一共展示了CCrmCompany::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CompareFields
public static function CompareFields(array $arFieldsOrig, array $arFieldsModif, array $arOptions = null)
{
if (!is_array($arOptions)) {
$arOptions = array();
}
$arMsg = array();
if (isset($arFieldsOrig['HONORIFIC']) || isset($arFieldsModif['HONORIFIC'])) {
$origHonorific = isset($arFieldsOrig['HONORIFIC']) ? $arFieldsOrig['HONORIFIC'] : '';
$modifHonrific = isset($arFieldsModif['HONORIFIC']) ? $arFieldsModif['HONORIFIC'] : '';
if ($origHonorific !== $modifHonrific) {
$arMsg[] = array('ENTITY_FIELD' => 'HONORIFIC', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_HONORIFIC'), 'EVENT_TEXT_1' => $origHonorific !== '' ? $origHonorific : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => $modifHonrific !== '' ? $modifHonrific : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
}
if (isset($arFieldsOrig['NAME']) && isset($arFieldsModif['NAME']) && $arFieldsOrig['NAME'] != $arFieldsModif['NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['NAME']) ? $arFieldsOrig['NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['NAME']) ? $arFieldsModif['NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['LAST_NAME']) && isset($arFieldsModif['LAST_NAME']) && $arFieldsOrig['LAST_NAME'] != $arFieldsModif['LAST_NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'LAST_NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_LAST_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['LAST_NAME']) ? $arFieldsOrig['LAST_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['LAST_NAME']) ? $arFieldsModif['LAST_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['SECOND_NAME']) && isset($arFieldsModif['SECOND_NAME']) && $arFieldsOrig['SECOND_NAME'] != $arFieldsModif['SECOND_NAME']) {
$arMsg[] = array('ENTITY_FIELD' => 'SECOND_NAME', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SECOND_NAME'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['SECOND_NAME']) ? $arFieldsOrig['SECOND_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['SECOND_NAME']) ? $arFieldsModif['SECOND_NAME'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['FM']) && isset($arFieldsModif['FM'])) {
$arMsg = array_merge($arMsg, CCrmFieldMulti::CompareFields($arFieldsOrig['FM'], $arFieldsModif['FM']));
}
if (isset($arFieldsOrig['POST']) && isset($arFieldsModif['POST']) && $arFieldsOrig['POST'] != $arFieldsModif['POST']) {
$arMsg[] = array('ENTITY_FIELD' => 'POST', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_POST'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['POST']) ? $arFieldsOrig['POST'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['POST']) ? $arFieldsModif['POST'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
$addressOptions = array();
if (isset($arOptions['ADDRESS_FIELDS'])) {
$addressOptions['FIELDS'] = $arOptions['ADDRESS_FIELDS'];
}
$arMsg = array_merge($arMsg, \Bitrix\Crm\ContactAddress::prepareChangeEvents($arFieldsOrig, $arFieldsModif, \Bitrix\Crm\ContactAddress::Primary, $addressOptions));
if (isset($arFieldsOrig['COMMENTS']) && isset($arFieldsModif['COMMENTS']) && $arFieldsOrig['COMMENTS'] != $arFieldsModif['COMMENTS']) {
$arMsg[] = array('ENTITY_FIELD' => 'COMMENTS', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMMENTS'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['COMMENTS']) ? $arFieldsOrig['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['COMPANY_ID']) && isset($arFieldsModif['COMPANY_ID']) && (int) $arFieldsOrig['COMPANY_ID'] != (int) $arFieldsModif['COMPANY_ID']) {
$arCompany = array();
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => array($arFieldsOrig['COMPANY_ID'], $arFieldsModif['COMPANY_ID'])));
while ($arRes = $dbRes->Fetch()) {
$arCompany[$arRes['ID']] = $arRes['TITLE'];
}
$arMsg[] = array('ENTITY_FIELD' => 'COMPANY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMPANY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arCompany, $arFieldsOrig['COMPANY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arCompany, $arFieldsModif['COMPANY_ID']));
}
if (isset($arFieldsOrig['SOURCE_ID']) && isset($arFieldsModif['SOURCE_ID']) && $arFieldsOrig['SOURCE_ID'] != $arFieldsModif['SOURCE_ID']) {
$arStatus = CCrmStatus::GetStatusList('SOURCE');
$arMsg[] = array('ENTITY_FIELD' => 'SOURCE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SOURCE_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['SOURCE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['SOURCE_ID'])));
}
if (isset($arFieldsOrig['SOURCE_DESCRIPTION']) && isset($arFieldsModif['SOURCE_DESCRIPTION']) && $arFieldsOrig['SOURCE_DESCRIPTION'] != $arFieldsModif['SOURCE_DESCRIPTION']) {
$arMsg[] = array('ENTITY_FIELD' => 'SOURCE_DESCRIPTION', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_SOURCE_DESCRIPTION'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['SOURCE_DESCRIPTION']) ? $arFieldsOrig['SOURCE_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['SOURCE_DESCRIPTION']) ? $arFieldsModif['SOURCE_DESCRIPTION'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['TYPE_ID']) && isset($arFieldsModif['TYPE_ID']) && $arFieldsOrig['TYPE_ID'] != $arFieldsModif['TYPE_ID']) {
$arStatus = CCrmStatus::GetStatusList('CONTACT_TYPE');
$arMsg[] = array('ENTITY_FIELD' => 'TYPE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TYPE_ID'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['TYPE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['TYPE_ID'])));
}
if (isset($arFieldsOrig['ASSIGNED_BY_ID']) && isset($arFieldsModif['ASSIGNED_BY_ID']) && (int) $arFieldsOrig['ASSIGNED_BY_ID'] != (int) $arFieldsModif['ASSIGNED_BY_ID']) {
$arUser = array();
$dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($arFieldsOrig['ASSIGNED_BY_ID']), intval($arFieldsModif['ASSIGNED_BY_ID'])))), array('FIELDS' => array('ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', 'TITLE', 'EMAIL')));
while ($arRes = $dbUsers->Fetch()) {
$arUser[$arRes['ID']] = CUser::FormatName(CSite::GetNameFormat(false), $arRes);
}
$arMsg[] = array('ENTITY_FIELD' => 'ASSIGNED_BY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_ASSIGNED_BY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arUser, $arFieldsOrig['ASSIGNED_BY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arUser, $arFieldsModif['ASSIGNED_BY_ID']));
}
if (isset($arFieldsOrig['BIRTHDATE']) || isset($arFieldsModif['BIRTHDATE'])) {
$origBirthdate = isset($arFieldsOrig['BIRTHDATE']) ? $arFieldsOrig['BIRTHDATE'] : '';
$modifBirthdate = isset($arFieldsModif['BIRTHDATE']) ? $arFieldsModif['BIRTHDATE'] : '';
if ($origBirthdate !== $modifBirthdate) {
$arMsg[] = array('ENTITY_FIELD' => 'BIRTHDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BIRTHDATE'), 'EVENT_TEXT_1' => $origBirthdate !== '' ? $origBirthdate : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => $modifBirthdate !== '' ? $modifBirthdate : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
}
return $arMsg;
}
示例2: UpdateSearch
public static function UpdateSearch($arFilter, $ENTITY_TYPE, $bOverWrite = false)
{
if (!CModule::IncludeModule('search')) {
return false;
}
$limit = 1000;
switch ($ENTITY_TYPE) {
case 'CONTACT':
$obRes = CCrmContact::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'FULL_NAME';
break;
case 'DEAL':
$obRes = CCrmDeal::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'TITLE';
break;
case 'INVOICE':
$obRes = CCrmInvoice::GetList(array('ID' => 'DESC'), $arFilter, false, array('nTopCount' => $limit), array('*'));
$sTitleID = 'ORDER_TOPIC';
break;
case 'QUOTE':
$obRes = CCrmQuote::GetList(array('ID' => 'ASC'), $arFilter, false, array('nTopCount' => intval($limit)), array());
$sTitleID = 'TITLE';
break;
case 'COMPANY':
$obRes = CCrmCompany::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'TITLE';
break;
default:
case 'LEAD':
$obRes = CCrmLead::GetList(array('ID' => 'ASC'), $arFilter, array(), $limit);
$sTitleID = 'TITLE';
$ENTITY_TYPE = 'LEAD';
break;
}
if (!isset(self::$arMess[$ENTITY_TYPE])) {
self::$arMess[$ENTITY_TYPE] = __IncludeLang($_SERVER['DOCUMENT_ROOT'] . BX_ROOT . '/components/bitrix/crm.' . strtolower($ENTITY_TYPE) . '.show/lang/' . LANGUAGE_ID . '/component.php', true);
}
$arAllResult = array();
$qty = 0;
$lastItemID = '';
if (is_object($obRes)) {
while (($arRow = $obRes->Fetch()) !== false) {
$elementID = $arRow['ID'];
$lastItemID = $ENTITY_TYPE . '.' . $elementID;
if ($ENTITY_TYPE === 'INVOICE') {
$arResult = CCrmInvoice::BuildSearchCard($arRow, self::$bReIndex);
} elseif ($ENTITY_TYPE === 'QUOTE') {
$arResult = CCrmQuote::BuildSearchCard($arRow, self::$bReIndex);
} else {
$multiFields = array();
if ($ENTITY_TYPE === 'CONTACT' || $ENTITY_TYPE === 'COMPANY' || $ENTITY_TYPE === 'LEAD') {
$obMultiFieldRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $ENTITY_TYPE, 'ELEMENT_ID' => $elementID));
while ($multiField = $obMultiFieldRes->Fetch()) {
$fieldValue = $multiField['VALUE'];
$fieldTypeID = $multiField['TYPE_ID'];
if ($fieldValue === '' || $fieldTypeID !== 'PHONE' && $fieldTypeID !== 'EMAIL') {
continue;
}
if (!isset($multiFields[$fieldTypeID])) {
$multiFields[$fieldTypeID] = array();
}
$multiFields[$fieldTypeID][] = $fieldValue;
}
}
$arResult = self::_buildEntityCard($arRow, $sTitleID, $ENTITY_TYPE, array('FM' => $multiFields));
}
if (self::$bReIndex) {
if (self::$oCallback) {
$res = call_user_func(array(self::$oCallback, self::$callback_method), $arResult);
if (!$res) {
return $lastItemID;
}
}
} else {
CSearch::Index('crm', $ENTITY_TYPE . '.' . $arRow['ID'], $arResult, $bOverWrite);
}
$arAllResult[] = $arResult;
$qty++;
}
}
if (!self::$bReIndex && !empty($arFilter['ID']) && $qty === 0) {
CSearch::DeleteIndex('crm', (int) $arFilter['ID']);
}
if (self::$bReIndex && $qty === $limit && $lastItemID !== '') {
return $lastItemID;
}
return $arAllResult;
}
示例3: SaveOrderDataCompany
private function SaveOrderDataCompany($arOrder)
{
if (!isset($arOrder["CONTRACTOR"]) || !is_array($arOrder["CONTRACTOR"])) {
return false;
}
$companyId = 0;
$companyXmlId = $arOrder["CONTRACTOR"]["ID"];
if (isset($arOrder["CONTRACTOR"]["INN"]) && $arOrder["CONTRACTOR"]["INN"] != "") {
$companyXmlId .= "|" . $arOrder["CONTRACTOR"]["INN"];
}
$dbCompany = CCrmCompany::GetList(array(), array("ORIGINATOR_ID" => $this->externalSaleId, "ORIGIN_ID" => $companyXmlId, "CHECK_PERMISSIONS" => "N"));
if ($arCompany = $dbCompany->Fetch()) {
$companyId = $arCompany["ID"];
}
$arFields = array('ORIGINATOR_ID' => $this->externalSaleId, 'ORIGIN_ID' => $companyXmlId, 'COMPANY_TYPE' => 'CUSTOMER');
if (isset($arOrder["CONTRACTOR"]["OFFICIAL_NAME"]) && $arOrder["CONTRACTOR"]["OFFICIAL_NAME"] != "") {
$arFields['TITLE'] = $arOrder["CONTRACTOR"]["OFFICIAL_NAME"];
} elseif (isset($arOrder["CONTRACTOR"]["NAME"]) && $arOrder["CONTRACTOR"]["NAME"] != "") {
$arFields['TITLE'] = $arOrder["CONTRACTOR"]["NAME"];
}
if (is_array($arOrder["CONTRACTOR"]["ADDRESS"])) {
foreach ($arOrder["CONTRACTOR"]["ADDRESS"] as $key => $val) {
if ($key == "VIEW") {
continue;
}
if (!empty($arFields["ADDRESS"])) {
$arFields["ADDRESS"] .= ", ";
}
$arFields["ADDRESS"] .= $val;
}
if (isset($arOrder["CONTRACTOR"]["ADDRESS"]["VIEW"])) {
if (!empty($arFields["ADDRESS"])) {
$arFields["ADDRESS"] .= "\n";
}
$arFields["ADDRESS"] .= $arOrder["CONTRACTOR"]["ADDRESS"]["VIEW"];
}
}
if (is_array($arOrder["CONTRACTOR"]["LEGAL_ADDRESS"])) {
foreach ($arOrder["CONTRACTOR"]["LEGAL_ADDRESS"] as $key => $val) {
if ($key == "VIEW") {
continue;
}
if (!empty($arFields["ADDRESS_LEGAL"])) {
$arFields["ADDRESS_LEGAL"] .= ", ";
}
$arFields["ADDRESS_LEGAL"] .= $val;
}
if (isset($arOrder["CONTRACTOR"]["LEGAL_ADDRESS"]["VIEW"])) {
if (!empty($arFields["ADDRESS_LEGAL"])) {
$arFields["ADDRESS_LEGAL"] .= "\n";
}
$arFields["ADDRESS_LEGAL"] .= $arOrder["CONTRACTOR"]["LEGAL_ADDRESS"]["VIEW"];
}
}
if (is_array($arOrder["CONTRACTOR"]["CONTACTS"])) {
$arFields["FM"] = array();
if ($companyId > 0) {
$dbCrmFieldMulti = CCrmFieldMulti::GetList(array(), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $companyId, "CHECK_PERMISSIONS" => "N"));
while ($arCrmFieldMulti = $dbCrmFieldMulti->Fetch()) {
$arFields["FM"][$arCrmFieldMulti["TYPE_ID"]][$arCrmFieldMulti["ID"]] = array("VALUE_TYPE" => $arCrmFieldMulti["VALUE_TYPE"], "VALUE" => $arCrmFieldMulti["VALUE"]);
}
}
$arMapTmp = array("MAIL" => "EMAIL", "E-MAIL" => "EMAIL", "WORKPHONE" => "PHONE");
$arInc = array();
foreach ($arOrder["CONTRACTOR"]["CONTACTS"] as $val) {
$t = strtoupper(preg_replace("/\\s/", "", $val["TYPE"]));
if (!isset($arMapTmp[$t])) {
continue;
}
$bFound = false;
$tNew = $arMapTmp[$t];
if (isset($arFields["FM"][$tNew]) && is_array($arFields["FM"][$tNew])) {
if (count($arFields["FM"][$tNew]) >= 50) {
//Disable adding new communication after threshold is exceeded
$bFound = true;
} else {
foreach ($arFields["FM"][$tNew] as $k => $v) {
if ($v["VALUE"] == $val["VALUE"]) {
$bFound = true;
break;
}
}
}
}
if (!$bFound) {
$arInc[$tNew]++;
$arFields["FM"][$tNew]["n" . $arInc[$tNew]] = array("VALUE_TYPE" => "WORK", "VALUE" => $val["VALUE"]);
}
}
}
$arMapTmp = array("INN", "KPP", "EGRPO", "OKVED", "OKDP", "OKOPF", "OKFC", "OKPO");
foreach ($arMapTmp as $m) {
if (isset($arOrder["CONTRACTOR"][$m])) {
$arFields["BANKING_DETAILS"] .= $m . ": " . $arOrder["CONTRACTOR"][$m] . "\n";
}
}
if (is_array($arOrder["CONTRACTOR"]["BANK_ADDRESS"])) {
foreach ($arOrder["CONTRACTOR"]["BANK_ADDRESS"] as $key => $val) {
if (!empty($arFields["BANKING_DETAILS"])) {
$arFields["BANKING_DETAILS"] .= ", ";
//.........这里部分代码省略.........
示例4: unset
$arRes['SID'] = $arResult['PREFIX'] == 'Y' ? 'C_' . $arRes['ID'] : $arRes['ID'];
if (isset($arResult['SELECTED'][$arRes['SID']])) {
unset($arResult['SELECTED'][$arRes['SID']]);
$sSelected = 'Y';
} else {
$sSelected = 'N';
}
$ar[] = array('title' => str_replace(array(';', ','), ' ', $arRes['FULL_NAME']), 'desc' => empty($arRes['COMPANY_TITLE']) ? '' : $arRes['COMPANY_TITLE'], 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])), 'image' => $strImg, 'type' => 'contact', 'selected' => $sSelected);
}
$arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
}
if (true || $arParams['arUserField']['SETTINGS']['COMPANY'] == 'Y' && isset($arSelected['COMPANY']) && !empty($arSelected['COMPANY'])) {
$arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
$arSelect = array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO');
$obRes = CCrmCompany::GetList(array('ID' => 'DESC'), array('ID' => 1), $arSelect);
$arFiles = array();
$ar = array();
while ($arRes = $obRes->Fetch()) {
$strImg = '';
if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
if ($arFile = CFile::GetFileArray($arRes['LOGO'])) {
$strImg = CHTTP::URN2URI($arFile['SRC']);
}
$arFiles[$arRes['LOGO']] = $strImg;
}
$arRes['SID'] = $arResult['PREFIX'] == 'Y' ? 'CO_' . $arRes['ID'] : $arRes['ID'];
if (isset($arResult['SELECTED'][$arRes['SID']])) {
unset($arResult['SELECTED'][$arRes['SID']]);
$sSelected = 'Y';
} else {
示例5: GetDocumentType
public static function GetDocumentType($documentId)
{
$arDocumentID = self::GetDocumentInfo($documentId);
if (empty($arDocumentID)) {
throw new CBPArgumentNullException('documentId');
}
switch ($arDocumentID['TYPE']) {
case 'CONTACT':
$dbDocumentList = CCrmContact::GetList(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), array('ID'));
break;
case 'COMPANY':
$dbDocumentList = CCrmCompany::GetList(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), array('ID'));
break;
case 'DEAL':
$dbDocumentList = CCrmDeal::GetList(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), array('ID'));
break;
case 'LEAD':
$dbDocumentList = CCrmLead::GetList(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), array('ID'));
break;
}
$arResult = $dbDocumentList->Fetch();
if (!$arResult) {
throw new Exception(GetMessage('CRM_DOCUMENT_ELEMENT_IS_NOT_FOUND'));
}
return $arDocumentID['TYPE'];
}
示例6: array
$matches = array();
if (preg_match('/^\\[(\\d+?)]/i', $search, $matches)) {
$matches[1] = intval($matches[1]);
if ($matches[1] > 0) {
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $matches[1]));
if ($arRes = $dbRes->Fetch()) {
$arData = array(array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'READY' => 'Y'));
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arData);
die;
}
}
}
$arData = array();
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('TITLE' => '%' . trim($search) . '%'));
while ($arRes = $dbRes->Fetch()) {
$arData[] = array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'READY' => 'Y');
}
if (empty($arData)) {
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => intval($search)));
if ($arRes = $dbRes->Fetch()) {
$arData = array(array('ID' => $arRes['ID'], 'NAME' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'READY' => 'Y'));
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arData);
die;
}
}
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject($arData);
die;
}
示例7: foreach
$arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
foreach ($arCompanyTypeList as $key => $value) {
if (strpos($value, $search) !== false) {
$arFilter['COMPANY_TYPE'][] = $key;
}
}
foreach ($arCompanyIndustryList as $key => $value) {
if (strpos($value, $search) !== false) {
$arFilter['INDUSTRY'][] = $key;
}
}
$arSelect = array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO');
$arOrder = array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC');
$arData = array();
$obRes = CCrmCompany::GetList($arOrder, $arFilter, $arSelect, $nPageTop);
$arFiles = array();
$i = 0;
$companyIndex = array();
while ($arRes = $obRes->Fetch()) {
$logoID = intval($arRes['LOGO']);
if ($logoID > 0 && !isset($arFiles[$logoID])) {
$arFiles[$logoID] = CFile::ResizeImageGet($logoID, array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
}
$arDesc = array();
if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
$arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
}
if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
$arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
}
示例8: CompareFields
public static function CompareFields($arFieldsOrig, $arFieldsModif, $bCheckPerms = true)
{
$arMsg = array();
if (isset($arFieldsOrig['TITLE']) && isset($arFieldsModif['TITLE']) && $arFieldsOrig['TITLE'] != $arFieldsModif['TITLE']) {
$arMsg[] = array('ENTITY_FIELD' => 'TITLE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TITLE'), 'EVENT_TEXT_1' => $arFieldsOrig['TITLE'], 'EVENT_TEXT_2' => $arFieldsModif['TITLE']);
}
if (isset($arFieldsOrig['COMPANY_ID']) && isset($arFieldsModif['COMPANY_ID']) && (int) $arFieldsOrig['COMPANY_ID'] != (int) $arFieldsModif['COMPANY_ID']) {
$arCompany = array();
$arFilterTmp = array('ID' => array($arFieldsOrig['COMPANY_ID'], $arFieldsModif['COMPANY_ID']));
if (!$bCheckPerms) {
$arFilterTmp["CHECK_PERMISSIONS"] = "N";
}
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), $arFilterTmp);
while ($arRes = $dbRes->Fetch()) {
$arCompany[$arRes['ID']] = $arRes['TITLE'];
}
$arMsg[] = array('ENTITY_FIELD' => 'COMPANY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMPANY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arCompany, $arFieldsOrig['COMPANY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arCompany, $arFieldsModif['COMPANY_ID']));
}
if (isset($arFieldsOrig['CONTACT_ID']) && isset($arFieldsModif['CONTACT_ID']) && (int) $arFieldsOrig['CONTACT_ID'] != (int) $arFieldsModif['CONTACT_ID']) {
$arContact = array();
$arFilterTmp = array('ID' => array($arFieldsOrig['CONTACT_ID'], $arFieldsModif['CONTACT_ID']));
if (!$bCheckPerms) {
$arFilterTmp["CHECK_PERMISSIONS"] = "N";
}
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), $arFilterTmp);
while ($arRes = $dbRes->Fetch()) {
$arContact[$arRes['ID']] = $arRes['LAST_NAME'] . ' ' . $arRes['NAME'];
}
$arMsg[] = array('ENTITY_FIELD' => 'CONTACT_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CONTACT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arContact, $arFieldsOrig['CONTACT_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arContact, $arFieldsModif['CONTACT_ID']));
}
if (isset($arFieldsOrig['ASSIGNED_BY_ID']) && isset($arFieldsModif['ASSIGNED_BY_ID']) && (int) $arFieldsOrig['ASSIGNED_BY_ID'] != (int) $arFieldsModif['ASSIGNED_BY_ID']) {
$arUser = array();
$dbUsers = CUser::GetList($sort_by = 'last_name', $sort_dir = 'asc', array('ID' => implode('|', array(intval($arFieldsOrig['ASSIGNED_BY_ID']), intval($arFieldsModif['ASSIGNED_BY_ID'])))), array('SELECT' => array('NAME', 'SECOND_NAME', 'LAST_NAME', 'LOGIN', 'EMAIL')));
while ($arRes = $dbUsers->Fetch()) {
$arUser[$arRes['ID']] = CUser::FormatName(CSite::GetNameFormat(false), $arRes);
}
$arMsg[] = array('ENTITY_FIELD' => 'ASSIGNED_BY_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_ASSIGNED_BY_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arUser, $arFieldsOrig['ASSIGNED_BY_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arUser, $arFieldsModif['ASSIGNED_BY_ID']));
}
if (isset($arFieldsOrig['STAGE_ID']) && isset($arFieldsModif['STAGE_ID']) && $arFieldsOrig['STAGE_ID'] != $arFieldsModif['STAGE_ID']) {
$arStatus = CCrmStatus::GetStatusList('DEAL_STAGE');
$arMsg[] = array('ENTITY_FIELD' => 'STAGE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_STAGE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['STAGE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['STAGE_ID'])));
}
/*
if (isset($arFieldsOrig['STATE_ID']) && isset($arFieldsModif['STATE_ID'])
&& $arFieldsOrig['STATE_ID'] != $arFieldsModif['STATE_ID'])
{
$CCrmStatus = new CCrmStatus('DEAL_STATE');
$arStatusOrig = $CCrmStatus->GetStatusByStatusId($arFieldsOrig['STATE_ID']);
$arStatusModif = $CCrmStatus->GetStatusByStatusId($arFieldsModif['STATE_ID']);
$arMsg[] = Array(
'ENTITY_FIELD' => 'STATE_ID',
'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_STATE'),
'EVENT_TEXT_1' => isset($arStatusOrig['NAME'])? $arStatusOrig['NAME']: GetMessage('CRM_FIELD_COMPARE_EMPTY'),
'EVENT_TEXT_2' => isset($arStatusModif['NAME'])? $arStatusModif['NAME']: GetMessage('CRM_FIELD_COMPARE_EMPTY'),
);
}
*/
if (isset($arFieldsOrig['TYPE_ID']) && isset($arFieldsModif['TYPE_ID']) && $arFieldsOrig['TYPE_ID'] != $arFieldsModif['TYPE_ID']) {
$arStatus = CCrmStatus::GetStatusList('DEAL_TYPE');
$arMsg[] = array('ENTITY_FIELD' => 'TYPE_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_DEAL_TYPE'), 'EVENT_TEXT_1' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsOrig['TYPE_ID'])), 'EVENT_TEXT_2' => htmlspecialcharsbx(CrmCompareFieldsList($arStatus, $arFieldsModif['TYPE_ID'])));
}
if (isset($arFieldsOrig['COMMENTS']) && isset($arFieldsModif['COMMENTS']) && $arFieldsOrig['COMMENTS'] != $arFieldsModif['COMMENTS']) {
$arMsg[] = array('ENTITY_FIELD' => 'COMMENTS', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_COMMENTS'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['COMMENTS']) ? $arFieldsOrig['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['COMMENTS']) ? $arFieldsModif['COMMENTS'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
// if (isset($arFieldsOrig['PRODUCT_ID']) && isset($arFieldsModif['PRODUCT_ID'])
// && $arFieldsOrig['PRODUCT_ID'] != $arFieldsModif['PRODUCT_ID'])
// {
// $arStatus = CCrmStatus::GetStatusList('PRODUCT');
// $arMsg[] = Array(
// 'ENTITY_FIELD' => 'PRODUCT_ID',
// 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_PRODUCT'),
// 'EVENT_TEXT_1' => CrmCompareFieldsList($arStatus, $arFieldsOrig['PRODUCT_ID']),
// 'EVENT_TEXT_2' => CrmCompareFieldsList($arStatus, $arFieldsModif['PRODUCT_ID'])
// );
// }
if (isset($arFieldsOrig['OPPORTUNITY']) && isset($arFieldsModif['OPPORTUNITY']) && $arFieldsOrig['OPPORTUNITY'] != $arFieldsModif['OPPORTUNITY'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
$arStatus = CCrmCurrencyHelper::PrepareListItems();
$arMsg[] = array('ENTITY_FIELD' => 'OPPORTUNITY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_OPPORTUNITY'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['OPPORTUNITY']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
}
if (isset($arFieldsOrig['TAX_VALUE']) && isset($arFieldsModif['TAX_VALUE']) && $arFieldsOrig['TAX_VALUE'] != $arFieldsModif['TAX_VALUE'] || isset($arFieldsOrig['CURRENCY_ID']) && isset($arFieldsModif['CURRENCY_ID']) && $arFieldsOrig['CURRENCY_ID'] != $arFieldsModif['CURRENCY_ID']) {
$arStatus = CCrmCurrencyHelper::PrepareListItems();
$arMsg[] = array('ENTITY_FIELD' => 'TAX_VALUE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_TAX_VALUE'), 'EVENT_TEXT_1' => floatval($arFieldsOrig['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsOrig['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''), 'EVENT_TEXT_2' => floatval($arFieldsModif['TAX_VALUE']) . (($val = CrmCompareFieldsList($arStatus, $arFieldsModif['CURRENCY_ID'], '')) != '' ? ' (' . $val . ')' : ''));
}
if (isset($arFieldsOrig['PROBABILITY']) && isset($arFieldsModif['PROBABILITY']) && $arFieldsOrig['PROBABILITY'] != $arFieldsModif['PROBABILITY']) {
$arMsg[] = array('ENTITY_FIELD' => 'PROBABILITY', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_PROBABILITY'), 'EVENT_TEXT_1' => intval($arFieldsOrig['PROBABILITY']) . '%', 'EVENT_TEXT_2' => intval($arFieldsModif['PROBABILITY']) . '%');
}
if (array_key_exists('BEGINDATE', $arFieldsOrig) && array_key_exists('BEGINDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) != $arFieldsModif['BEGINDATE'] && $arFieldsOrig['BEGINDATE'] != $arFieldsModif['BEGINDATE']) {
$arMsg[] = array('ENTITY_FIELD' => 'BEGINDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_BEGINDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['BEGINDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['BEGINDATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['BEGINDATE']) ? $arFieldsModif['BEGINDATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (array_key_exists('CLOSEDATE', $arFieldsOrig) && array_key_exists('CLOSEDATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) != $arFieldsModif['CLOSEDATE'] && $arFieldsOrig['CLOSEDATE'] != $arFieldsModif['CLOSEDATE']) {
$arMsg[] = array('ENTITY_FIELD' => 'CLOSEDATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_CLOSEDATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['CLOSEDATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['CLOSEDATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['CLOSEDATE']) ? $arFieldsModif['CLOSEDATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (array_key_exists('EVENT_DATE', $arFieldsOrig) && array_key_exists('EVENT_DATE', $arFieldsModif) && ConvertTimeStamp(strtotime($arFieldsOrig['EVENT_DATE'])) != $arFieldsModif['EVENT_DATE'] && $arFieldsOrig['EVENT_DATE'] != $arFieldsModif['EVENT_DATE']) {
$arMsg[] = array('ENTITY_FIELD' => 'EVENT_DATE', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_DATE'), 'EVENT_TEXT_1' => !empty($arFieldsOrig['EVENT_DATE']) ? ConvertTimeStamp(strtotime($arFieldsOrig['EVENT_DATE'])) : GetMessage('CRM_FIELD_COMPARE_EMPTY'), 'EVENT_TEXT_2' => !empty($arFieldsModif['EVENT_DATE']) ? $arFieldsModif['EVENT_DATE'] : GetMessage('CRM_FIELD_COMPARE_EMPTY'));
}
if (isset($arFieldsOrig['EVENT_ID']) && isset($arFieldsModif['EVENT_ID']) && $arFieldsOrig['EVENT_ID'] != $arFieldsModif['EVENT_ID']) {
$arStatus = CCrmStatus::GetStatusList('EVENT_TYPE');
$arMsg[] = array('ENTITY_FIELD' => 'EVENT_ID', 'EVENT_NAME' => GetMessage('CRM_FIELD_COMPARE_EVENT_ID'), 'EVENT_TEXT_1' => CrmCompareFieldsList($arStatus, $arFieldsOrig['EVENT_ID']), 'EVENT_TEXT_2' => CrmCompareFieldsList($arStatus, $arFieldsModif['EVENT_ID']));
}
//.........这里部分代码省略.........
示例9: TryInternalizeCrmEntityID
private static function TryInternalizeCrmEntityID($type, $value, &$ID)
{
if (preg_match('/^\\[([A-Z]+)\\]/i', $value, $m) > 0) {
$valueType = CCrmOwnerType::Undefined;
$prefix = strtoupper($m[1]);
if ($prefix === 'L') {
$valueType = CCrmOwnerType::Lead;
} elseif ($prefix === 'C') {
$valueType = CCrmOwnerType::Contact;
} elseif ($prefix === 'CO') {
$valueType = CCrmOwnerType::Company;
} elseif ($prefix === 'D') {
$valueType = CCrmOwnerType::Deal;
}
if ($valueType !== CCrmOwnerType::Undefined && $valueType !== $type) {
return false;
}
$value = substr($value, strlen($m[0]));
}
// 1. Try to interpret data as entity ID
// 2. Try to interpret data as entity name
if ($type === CCrmOwnerType::Lead) {
if (is_numeric($value)) {
$arEntity = CCrmLead::GetByID($value);
if ($arEntity) {
$ID = intval($arEntity['ID']);
return true;
}
}
$rsEntities = CCrmLead::GetListEx(array(), array('=TITLE' => $value), false, false, array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
} elseif ($type === CCrmOwnerType::Contact) {
if (is_numeric($value)) {
$arEntity = CCrmContact::GetByID($value);
if ($arEntity) {
$ID = intval($arEntity['ID']);
return true;
}
}
// Try to interpret value as FULL_NAME
$rsEntities = CCrmContact::GetListEx(array(), array('=FULL_NAME' => $value), false, false, array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
if (preg_match('/\\s*([^\\s]+)\\s+([^\\s]+)\\s*/', $value, $match) > 0) {
// Try to interpret value as '#NAME# #LAST_NAME#'
$rsEntities = CCrmContact::GetListEx(array(), array('=NAME' => $match[1], '=LAST_NAME' => $match[2]), false, false, array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
// Try to interpret value as '#LAST_NAME# #NAME#'
$rsEntities = CCrmContact::GetListEx(array(), array('=LAST_NAME' => $match[1], '=NAME' => $match[2]), false, false, array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
} else {
// Try to interpret value as '#LAST_NAME#'
$rsEntities = CCrmContact::GetListEx(array(), array('=LAST_NAME' => $value), false, false, array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
}
} elseif ($type === CCrmOwnerType::Company) {
if (is_numeric($value)) {
$arEntity = CCrmCompany::GetByID($value);
if ($arEntity) {
$ID = intval($arEntity['ID']);
return true;
}
}
$rsEntities = CCrmCompany::GetList(array(), array('=TITLE' => $value), array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
} elseif ($type === CCrmOwnerType::Deal) {
if (is_numeric($value)) {
$arEntity = CCrmDeal::GetByID($value);
if ($arEntity) {
$ID = intval($arEntity['ID']);
return true;
}
}
$rsEntities = CCrmDeal::GetList(array(), array('=TITLE' => $value), array('ID'));
while ($arEntity = $rsEntities->Fetch()) {
$ID = intval($arEntity['ID']);
return true;
}
}
return false;
}
示例10: intval
$arProductRow['QUANTITY'] = intval($data);
}
} elseif ($currentKey == 'EVENT_ID') {
if (isset($arStatus['EVENT_LIST'][$data])) {
$arDeal[$currentKey] = $data;
} else {
$result = array_search($data, $arStatus['EVENT_LIST']);
$arDeal[$currentKey] = $result !== false ? $result : $data;
}
} elseif ($currentKey == 'CLOSED' || $currentKey == 'OPENED') {
$arDeal[$currentKey] = isset($arStatus[$currentKey . '_LIST'][$data]) ? $data : array_search($data, $arStatus[$currentKey . '_LIST']);
if ($arDeal[$currentKey] === false) {
unset($arDeal[$currentKey]);
}
} elseif ($currentKey == 'COMPANY_ID') {
$obRes = CCrmCompany::GetList(array(), array('TITLE' => $data), array('ID'));
if (($arRow = $obRes->Fetch()) !== false) {
$arDeal[$currentKey] = $arRow['ID'];
}
} elseif ($currentKey == 'CONTACT_ID') {
$obRes = CCrmContact::GetList(array(), array('FULL_NAME' => $data), array('ID'));
if (($arRow = $obRes->Fetch()) !== false) {
$arDeal[$currentKey] = $arRow['ID'];
}
} elseif ($currentKey == 'ASSIGNED_BY_ID') {
$userID = 0;
if (is_numeric($data)) {
// 1. Try to interpret value as user ID
$userID = is_int($data) ? $data : intval($data);
if ($userID > 0 && !isset($usersByID[$userID])) {
$dbUsers = CUser::GetList($by = 'ID', $order = 'ASC', array('ID' => $userID), array('FIELDS' => array('ID')));
示例11: while
$contactFormattedName = '';
while ($arContact = $dbRes->Fetch()) {
if (isset($arContactList[$arContact['ID']]) && is_array($arContactList[$arContact['ID']]) && count($arContactList[$arContact['ID']]) > 0) {
foreach ($arContactList[$arContact['ID']] as $invoiceId) {
$arResult['INVOICE'][$invoiceId]['CONTACT_FORMATTED_NAME'] = $contactFormattedName = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => $arContact['LOGIN'], 'NAME' => $arContact['NAME'], 'LAST_NAME' => $arContact['LAST_NAME'], 'SECOND_NAME' => $arContact['SECOND_NAME']));
$arResult['INVOICE'][$invoiceId]['CONTACT_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $arContact['ID'], 'PREFIX' => uniqid("crm_contact_link_"), 'TITLE' => $contactFormattedName, 'CLASS_NAME' => ''));
}
unset($invoiceId);
}
}
unset($arContact, $contactFormattedName);
}
unset($dbRes);
}
if (count($arCompanyList) > 0) {
$dbRes = CCrmCompany::GetList(array(), array('ID' => array_keys($arCompanyList)), array('TITLE'));
if ($dbRes) {
$arCompany = array();
while ($arCompany = $dbRes->Fetch()) {
if (isset($arCompanyList[$arCompany['ID']]) && is_array($arCompanyList[$arCompany['ID']]) && count($arCompanyList[$arCompany['ID']]) > 0) {
foreach ($arCompanyList[$arCompany['ID']] as $invoiceId) {
$arResult['INVOICE'][$invoiceId]['COMPANY_TITLE'] = $arCompany['TITLE'];
$arResult['INVOICE'][$invoiceId]['COMPANY_LINK_HTML'] = CCrmViewHelper::PrepareEntityBaloonHtml(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $arCompany['ID'], 'PREFIX' => uniqid("crm_company_link_"), 'TITLE' => $arCompany['TITLE'], 'CLASS_NAME' => ''));
}
unset($invoiceId);
}
}
unset($arCompany);
}
unset($dbRes);
}
示例12: InstallService
function InstallService($serviceID, $serviceStage)
{
$wizard =& $this->GetWizard();
if (CModule::IncludeModule("iblock")) {
$type = substr($serviceID, 0, -1);
if ($type == "iblockElement") {
$dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockElement::Delete($arItem["ID"]);
}
} elseif ($type == "iblockSectionElement") {
$dbItem = CIBlockElement::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockElement::Delete($arItem["ID"]);
}
$dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => $serviceStage), false, array("ID"));
while ($arItem = $dbItem->Fetch()) {
CIBlockSection::Delete($arItem["ID"]);
}
} elseif ($serviceID == "iblockDepartmentsElement") {
$dbItem = CIBlockSection::GetList(array(), array("=IBLOCK_CODE" => "departments"));
while ($arItem = $dbItem->Fetch()) {
if ($arItem["DEPTH_LEVEL"] > 2) {
CIBlockSection::Delete($arItem["ID"]);
}
}
} elseif ($serviceID == "tasks") {
if (CModule::IncludeModule("tasks")) {
$dbItem = CTasks::GetList(array(), array("SITE_ID" => $wizard->GetVar("siteID")));
while ($arItem = $dbItem->Fetch()) {
CTasks::Delete($arItem["ID"]);
}
}
} elseif ($serviceID == "calendar") {
if (CModule::IncludeModule("calendar")) {
$dbItem = CCalendarEvent::GetList();
foreach ($dbItem as $arItem) {
CCalendarEvent::Delete(array("id" => $arItem["ID"]));
}
}
} elseif ($serviceID == "meeting") {
if (CModule::IncludeModule("meeting")) {
$dbItem = CMeeting::GetList(array(), array());
while ($arItem = $dbItem->Fetch()) {
if ($arItem["ID"]) {
CMeeting::Delete($arItem["ID"]);
}
}
}
} elseif ($serviceID == "user") {
if ($serviceStage == "user") {
$dbUser = CUser::GetList($by = "ID", $order = "DESC", array(">ID" => 1));
while ($arUser = $dbUser->Fetch()) {
CUser::Delete($arUser["ID"]);
}
}
} elseif ($serviceID == "crm") {
if ($serviceStage == "crm") {
if (CModule::IncludeModule('crm')) {
$CCrmLead = new CCrmLead();
$resLead = CCrmLead::GetList(array(), array(), array(), false);
while ($rowLead = $resLead->Fetch()) {
$CCrmLead->Delete($rowLead["ID"]);
}
$CCrmContact = new CCrmContact();
$resContact = CCrmContact::GetList(array(), array(), array(), false);
while ($rowContact = $resContact->Fetch()) {
$CCrmContact->Delete($rowContact["ID"]);
}
$CCrmCompany = new CCrmCompany();
$resCompany = CCrmCompany::GetList(array(), array(), array(), false);
while ($rowCompany = $resCompany->Fetch()) {
$CCrmCompany->Delete($rowCompany["ID"]);
}
$CCrmDeal = new CCrmDeal();
$resDeal = CCrmDeal::GetList(array(), array(), array(), false);
while ($rowDeal = $resDeal->Fetch()) {
$CCrmDeal->Delete($rowDeal["ID"]);
}
}
}
} elseif ($serviceID == "cache") {
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/cache_html.php";
if ($serviceStage == "cache1") {
BXClearCache(true);
} elseif ($serviceStage == "cache2") {
$GLOBALS["CACHE_MANAGER"]->CleanAll();
} elseif ($serviceStage == "cache3") {
$GLOBALS["stackCacheManager"]->CleanAll();
} elseif ($serviceStage == "cache4") {
CHTMLPagesCache::CleanAll();
}
COption::SetOptionString("main", "wizard_clear_exec", "Y", false, $wizard->GetVar("siteID"));
}
}
}
示例13: CCrmPerms
}
global $APPLICATION;
$CCrmPerms = new CCrmPerms($USER->GetID());
if (!$USER->IsAuthorized() || $CCrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE)) {
return;
}
$arResult = array();
$_GET['USER_ID'] = preg_replace('/^(CONTACT|COMPANY|LEAD|DEAL)_/i' . BX_UTF_PCRE_MODIFIER, '', $_GET['USER_ID']);
$iCompanyId = (int) $_GET['USER_ID'];
if ($iCompanyId > 0) {
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
$arParams['PATH_TO_COMPANY_SHOW'] = CrmCheckPath('PATH_TO_COMPANY_SHOW', $arParams['PATH_TO_COMPANY_SHOW'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&show');
$arParams['PATH_TO_COMPANY_EDIT'] = CrmCheckPath('PATH_TO_COMPANY_EDIT', $arParams['PATH_TO_COMPANY_EDIT'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&edit');
$arResult['COMPANY_TYPE_LIST'] = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arResult['EMPLOYEES_LIST'] = CCrmStatus::GetStatusListEx('EMPLOYEES');
$obRes = CCrmCompany::GetList(array(), array('ID' => $iCompanyId));
$arCompany = $obRes->Fetch();
if ($arCompany == false) {
return;
}
$res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $iCompanyId));
while ($ar = $res->Fetch()) {
if (empty($arCompany[$ar['COMPLEX_ID']])) {
$arCompany[$ar['COMPLEX_ID']] = CCrmFieldMulti::GetTemplateByComplex($ar['COMPLEX_ID'], $ar['VALUE']);
}
}
$arCompany['PATH_TO_COMPANY_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $iCompanyId));
$arCompany['PATH_TO_COMPANY_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_EDIT'], array('company_id' => $iCompanyId));
$strCard = '
<div class="bx-user-info-data-cont-video bx-user-info-fields" id="bx_user_info_data_cont_1">
<div class="bx-user-info-data-name ">
示例14: isset
$arResult['STATUS_LIST']['REFERENCE'][] = $value;
$arResult['STATUS_LIST']['REFERENCE_ID'][] = $key;
}
}
if ($arParams['EVENT_TYPE'] === 'PHONE') {
$contactID = isset($arRes['CONTACT_ID']) ? intval($arRes['CONTACT_ID']) : 0;
if ($contactID > 0) {
$rsContacts = CCrmContact::GetList(array(), array('ID' => $contactID), array('FULL_NAME'), 1);
$arContact = $rsContacts->Fetch();
if ($arContact) {
$arResult['PHONE_GROUPS'][] = array('TITLE' => $arContact['FULL_NAME'], 'PHONES' => __CrmEventGetPhones('CONTACT', $contactID));
}
}
$companyID = isset($arRes['COMPANY_ID']) ? intval($arRes['COMPANY_ID']) : 0;
if ($companyID > 0) {
$rsCompanies = CCrmCompany::GetList(array(), array('ID' => $companyID), array('TITLE'), 1);
$arCompany = $rsCompanies->Fetch();
if ($arCompany) {
$arResult['PHONE_GROUPS'][] = array('TITLE' => $arCompany['TITLE'], 'PHONES' => __CrmEventGetPhones('COMPANY', $companyID));
}
}
}
}
break;
}
$arResult['EVENT_TYPE'] = array();
$arEventType = CCrmStatus::GetStatusList('EVENT_TYPE');
foreach ($arEventType as $key => $value) {
if ($arResult['ENTITY_TYPE'] !== 'QUOTE' || !($key === 'PHONE' || $key === 'MESSAGE')) {
$arResult['EVENT_TYPE']['REFERENCE'][] = $value;
$arResult['EVENT_TYPE']['REFERENCE_ID'][] = $key;
示例15: ListAddEnumFieldsValue
//.........这里部分代码省略.........
}
}
$arReplaceValue[$ID][$FIELD_NAME] = '';
} else {
if ($arUserField['USER_TYPE']['USER_TYPE_ID'] == 'file' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'employee' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_element' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'enumeration' || $arUserField['USER_TYPE']['USER_TYPE_ID'] == 'iblock_section') {
$bSecondLoop = true;
$arVal = $arValue[$ID][$FIELD_NAME];
$arReplaceValue[$ID][$FIELD_NAME] = '';
if (!is_array($arVal)) {
$arVal = array($arVal);
}
foreach ($arVal as $value) {
$arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['FIELD'][$ID][$FIELD_NAME][$value] = $value;
$arValuePrepare[$arUserField['USER_TYPE']['USER_TYPE_ID']]['ID'][] = $value;
}
} else {
if ($arUserField['MULTIPLE'] == 'Y' && is_array($arValue[$ID][$FIELD_NAME])) {
array_walk($arValue[$ID][$FIELD_NAME], create_function('&$v', '$v = htmlspecialcharsbx($v);'));
$arReplaceValue[$ID][$FIELD_NAME] = implode($delimiter, $arValue[$ID][$FIELD_NAME]);
}
}
}
}
}
}
unset($arUserField);
// The second loop for special field
if ($bSecondLoop) {
$arValueReplace = array();
$arList = array();
foreach ($arValuePrepare as $KEY => $VALUE) {
// collect multi data
if ($KEY == 'iblock_section') {
$dbRes = CIBlockSection::GetList(array('left_margin' => 'asc'), array('ID' => $VALUE['ID']), false);
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'file') {
$dbRes = CFile::GetList(array(), array('@ID' => implode(',', $VALUE['ID'])));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'iblock_element') {
$dbRes = CIBlockElement::GetList(array('SORT' => 'DESC', 'NAME' => 'ASC'), array('ID' => $VALUE['ID']), false);
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'employee') {
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', array('ID' => implode('|', $VALUE['ID'])));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
} elseif ($KEY == 'enumeration') {
foreach ($VALUE['ID'] as $___value) {
$rsEnum = CUserFieldEnum::GetList(array(), array('ID' => $___value));
while ($arRes = $rsEnum->Fetch()) {
$arList[$KEY][$arRes['ID']] = $arRes;
}
}
} elseif ($KEY == 'crm') {
if (isset($VALUE['LEAD']) && !empty($VALUE['LEAD'])) {
$dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => $VALUE['LEAD']));
while ($arRes = $dbRes->Fetch()) {
$arList[$KEY]['LEAD'][$arRes['ID']] = $arRes;
}
}