本文整理汇总了PHP中CCrmCompany::GetListEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmCompany::GetListEx方法的具体用法?PHP CCrmCompany::GetListEx怎么用?PHP CCrmCompany::GetListEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmCompany
的用法示例。
在下文中一共展示了CCrmCompany::GetListEx方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCompanyInfo
protected static function getCompanyInfo($companyID)
{
if ($companyID <= 0) {
return array();
}
$result = array('TITLE' => '', 'FULL_ADDRESS' => '', 'PHONE' => '', 'EMAIL' => '');
$dbRes = \CCrmCompany::GetListEx(array(), array('=ID' => $companyID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('TITLE', 'ADDRESS', 'ADDRESS_2', 'ADDRESS_CITY', 'ADDRESS_POSTAL_CODE', 'ADDRESS_REGION', 'ADDRESS_PROVINCE', 'ADDRESS_COUNTRY'));
$fields = is_object($dbRes) ? $dbRes->Fetch() : null;
if (is_array($fields)) {
$result['TITLE'] = isset($fields['TITLE']) ? $fields['TITLE'] : '';
$result['FULL_ADDRESS'] = Format\CompanyAddressFormatter::format($fields, array('SEPARATOR' => Format\AddressSeparator::NewLine));
$dbRes = \CCrmFieldMulti::GetListEx(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $companyID, '@TYPE_ID' => array('PHONE', 'EMAIL')), false, false, array('TYPE_ID', 'VALUE'));
while ($multiFields = $dbRes->Fetch()) {
if ($result['PHONE'] === '' && $multiFields['TYPE_ID'] === 'PHONE') {
$result['PHONE'] = $multiFields['VALUE'];
} elseif ($result['EMAIL'] === '' && $multiFields['TYPE_ID'] === 'EMAIL') {
$result['EMAIL'] = $multiFields['VALUE'];
}
if ($result['PHONE'] !== '' && $result['EMAIL'] !== '') {
break;
}
}
}
return $result;
}
示例2: array
} else {
$arResult['ENTITY_IMAGE_URL'] = SITE_DIR . 'bitrix/templates/mobile_app/images/crm/no_contact_big.png?ver=1';
}
$arResult['ENTITY_TITLE'] = CUser::FormatName($arParams['NAME_TEMPLATE'], array('LOGIN' => '', 'NAME' => isset($entity['NAME']) ? $entity['NAME'] : '', 'LAST_NAME' => isset($entity['LAST_NAME']) ? $entity['LAST_NAME'] : '', 'SECOND_NAME' => isset($entity['SECOND_NAME']) ? $entity['SECOND_NAME'] : ''), false, false);
$companyTitle = isset($entity['COMPANY_TITLE']) ? $entity['COMPANY_TITLE'] : '';
$post = isset($entity['POST']) ? $entity['POST'] : '';
if ($companyTitle !== '' && $post !== '') {
$arResult['ENTITY_LEGEND'] = "{$companyTitle}, {$post}";
} elseif ($companyTitle !== '') {
$arResult['ENTITY_LEGEND'] = $companyTitle;
} elseif ($post !== '') {
$arResult['ENTITY_LEGEND'] = $post;
}
}
} elseif ($entityTypeID === CCrmOwnerType::Company) {
$dbEntity = CCrmCompany::GetListEx(array(), array('ID' => $entityID), false, false, array('TITLE', 'LOGO'));
$entity = $dbEntity ? $dbEntity->Fetch() : null;
if ($entity) {
if (isset($entity['LOGO'])) {
$arResult['ENTITY_IMAGE_ID'] = intval($entity['LOGO']);
} else {
$arResult['ENTITY_IMAGE_URL'] = SITE_DIR . 'bitrix/templates/mobile_app/images/crm/no_company_big.png?ver=1';
}
$arResult['ENTITY_TITLE'] = isset($entity['TITLE']) ? $entity['TITLE'] : '';
}
}
$dbRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('TYPE_ID' => $arParams['TYPE_ID'], 'ENTITY_ID' => $entityTypeName, 'ELEMENT_ID' => $entityID));
$arResult['ITEMS'] = array();
if ($dbRes) {
while ($item = $dbRes->Fetch()) {
$value = $item['VALUE'];
示例3: PreparePopupItems
public static function PreparePopupItems($entityTypeNames, $addPrefix = true, $nameFormat = '', $count = 50)
{
if (!is_array($entityTypeNames)) {
$entityTypeNames = array(strval($entityTypeNames));
}
$addPrefix = (bool) $addPrefix;
$count = intval($count);
if ($count <= 0) {
$count = 50;
}
$arItems = array();
$i = 0;
foreach ($entityTypeNames as $typeName) {
$typeName = strtoupper(strval($typeName));
if ($typeName === 'CONTACT') {
$contactTypes = CCrmStatus::GetStatusList('CONTACT_TYPE');
$contactIndex = array();
$obRes = CCrmContact::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'COMPANY_TITLE', 'PHOTO', 'TYPE_ID'));
while ($arRes = $obRes->Fetch()) {
$arImg = array();
if (!empty($arRes['PHOTO']) && !isset($arFiles[$arRes['PHOTO']])) {
if (intval($arRes['PHOTO']) > 0) {
$arImg = CFile::ResizeImageGet($arRes['PHOTO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
}
}
$arRes['SID'] = $addPrefix ? 'C_' . $arRes['ID'] : $arRes['ID'];
// advanced info
$advancedInfo = array();
if (isset($arRes['TYPE_ID']) && $arRes['TYPE_ID'] != '' && isset($contactTypes[$arRes['TYPE_ID']])) {
$advancedInfo['contactType'] = array('id' => $arRes['TYPE_ID'], 'name' => $contactTypes[$arRes['TYPE_ID']]);
}
$arItems[$i] = array('title' => CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($arRes['HONORIFIC']) ? $arRes['HONORIFIC'] : '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), $nameFormat), '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' => $arImg['src'], 'type' => 'contact', 'selected' => 'N');
if (!empty($advancedInfo)) {
$arItems[$i]['advancedInfo'] = $advancedInfo;
}
unset($advancedInfo);
$contactIndex[$arRes['ID']] =& $arItems[$i];
$i++;
}
// advanced info - phone number, e-mail
$obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => array_keys($contactIndex)));
while ($arRes = $obRes->Fetch()) {
if (isset($contactIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
$item =& $contactIndex[$arRes['ELEMENT_ID']];
if (!is_array($item['advancedInfo'])) {
$item['advancedInfo'] = array();
}
if (!is_array($item['advancedInfo']['multiFields'])) {
$item['advancedInfo']['multiFields'] = array();
}
$item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
unset($item);
}
}
unset($contactIndex);
} elseif ($typeName === 'COMPANY') {
$companyIndex = array();
$arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
$obRes = CCrmCompany::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO'));
$arFiles = array();
while ($arRes = $obRes->Fetch()) {
$arImg = array();
if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
if (intval($arRes['LOGO']) > 0) {
$arImg = CFile::ResizeImageGet($arRes['LOGO'], array('width' => 25, 'height' => 25), BX_RESIZE_IMAGE_EXACT);
}
$arFiles[$arRes['LOGO']] = $arImg['src'];
}
$arRes['SID'] = $addPrefix ? 'CO_' . $arRes['ID'] : $arRes['ID'];
$arDesc = array();
if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
$arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
}
if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
$arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
}
$arItems[$i] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => implode(', ', $arDesc), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])), 'image' => $arImg['src'], 'type' => 'company', 'selected' => 'N');
$companyIndex[$arRes['ID']] =& $arItems[$i];
$i++;
}
// advanced info - phone number, e-mail
$obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => array_keys($companyIndex)));
while ($arRes = $obRes->Fetch()) {
if (isset($companyIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
$item =& $companyIndex[$arRes['ELEMENT_ID']];
if (!is_array($item['advancedInfo'])) {
$item['advancedInfo'] = array();
}
if (!is_array($item['advancedInfo']['multiFields'])) {
$item['advancedInfo']['multiFields'] = array();
}
$item['advancedInfo']['multiFields'][] = array('ID' => $arRes['ID'], 'TYPE_ID' => $arRes['TYPE_ID'], 'VALUE_TYPE' => $arRes['VALUE_TYPE'], 'VALUE' => $arRes['VALUE']);
unset($item);
}
}
unset($companyIndex);
} elseif ($typeName === 'LEAD') {
$leadIndex = array();
$obRes = CCrmLead::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'STATUS_ID'));
//.........这里部分代码省略.........
示例4: ExportOrders2Xml
//.........这里部分代码省略.........
if (IntVal($arOrder["USER_ID"]) > 0)
{
$dbUser = CUser::GetByID($arOrder["USER_ID"]);
if ($arUser = $dbUser->Fetch())
$arProp["USER"] = $arUser;
}
if ($bExportFromCrm)
{
$arProp["CRM"] = array();
$companyID = isset($arOrder["UF_COMPANY_ID"]) ? intval($arOrder["UF_COMPANY_ID"]) : 0;
$contactID = isset($arOrder["UF_CONTACT_ID"]) ? intval($arOrder["UF_CONTACT_ID"]) : 0;
if ($companyID > 0)
{
$arProp["CRM"]["CLIENT_ID"] = "CRMCO".$companyID;
}
else
{
$arProp["CRM"]["CLIENT_ID"] = "CRMC".$contactID;
}
$clientInfo = array(
"LOGIN" => "",
"NAME" => "",
"LAST_NAME" => "",
"SECOND_NAME" => ""
);
if ($bCrmModuleIncluded)
{
if ($companyID > 0)
{
$arCompanyFilter = array('=ID' => $companyID);
$dbCompany = CCrmCompany::GetListEx(
array(), $arCompanyFilter, false, array("nTopCount" => 1),
array("TITLE")
);
$arCompany = $dbCompany->Fetch();
unset($dbCompany, $arCompanyFilter);
if (is_array($arCompany))
{
if (isset($arCompany["TITLE"]))
$clientInfo["NAME"] = $arCompany["TITLE"];
}
unset($arCompany);
}
else if ($contactID > 0)
{
$arContactFilter = array('=ID' => $contactID);
$dbContact = CCrmContact::GetListEx(
array(), $arContactFilter, false, array("nTopCount" => 1),
array("NAME", "LAST_NAME", "SECOND_NAME")
);
$arContact = $dbContact->Fetch();
unset($dbContact, $arContactFilter);
if (is_array($arContact))
{
if (isset($arContact["NAME"]))
$clientInfo["NAME"] = $arContact["NAME"];
if (isset($arContact["LAST_NAME"]))
$clientInfo["LAST_NAME"] = $arContact["LAST_NAME"];
if (isset($arContact["SECOND_NAME"]))
$clientInfo["SECOND_NAME"] = $arContact["SECOND_NAME"];
}
unset($arContact);
}
示例5: GetUsersFromUserGroup
public static function GetUsersFromUserGroup($group, $documentId)
{
$groupLc = strtolower($group);
if ($groupLc == 'author') {
$arDocumentID = self::GetDocumentInfo($documentId);
if (empty($arDocumentID)) {
return array();
}
$dbDocumentList = null;
$entityID = isset($arDocumentID['ID']) ? intval($arDocumentID['ID']) : 0;
if ($entityID > 0) {
switch ($arDocumentID['TYPE']) {
case 'CONTACT':
$dbDocumentList = CCrmContact::GetListEx(array(), array('ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ASSIGNED_BY_ID'));
break;
case 'COMPANY':
$dbDocumentList = CCrmCompany::GetListEx(array(), array('ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ASSIGNED_BY_ID'));
break;
case 'DEAL':
$dbDocumentList = CCrmDeal::GetListEx(array(), array('ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ASSIGNED_BY_ID'));
break;
case 'LEAD':
$dbDocumentList = CCrmLead::GetListEx(array(), array('ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ASSIGNED_BY_ID'));
break;
}
}
$arFields = is_object($dbDocumentList) ? $dbDocumentList->Fetch() : null;
return is_array($arFields) && isset($arFields['ASSIGNED_BY_ID']) ? array($arFields['ASSIGNED_BY_ID']) : array();
} elseif ($groupLc == 'ungrouped') {
return isset(self::$UNGROUPED_USERS[$documentId]) ? self::$UNGROUPED_USERS[$documentId] : array();
}
$group = (int) $group;
if ($group <= 0) {
return array();
}
$arResult = array();
$dbUsersList = CUser::GetList($b = 'ID', $o = 'ASC', array('GROUPS_ID' => $group, 'ACTIVE' => 'Y'));
while ($arUser = $dbUsersList->Fetch()) {
$arResult[] = $arUser['ID'];
}
return $arResult;
}
示例6: array
$i++;
if ($i == 1) {
continue;
}
$arTmp = array("PHOTO" => false, "NAME" => false, "URL" => false, "COMPANY" => false, "COMM" => false);
if (in_array($arCommunication["ENTITY_TYPE_ID"], array(CCrmOwnerType::Company, CCrmOwnerType::Contact, CCrmOwnerType::Lead))) {
if ($arCommunication["ENTITY_TYPE_ID"] == CCrmOwnerType::Contact) {
$dbRes = CCrmContact::GetListEx(array(), array('=ID' => $arCommunication["ENTITY_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('PHOTO'));
if (($arRes = $dbRes->Fetch()) && intval($arRes["PHOTO"]) > 0) {
$arFileTmp = CFile::ResizeImageGet($arRes["PHOTO"], array('width' => 21, 'height' => 21), BX_RESIZE_IMAGE_EXACT, false);
if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
$arTmp["PHOTO"] = $arFileTmp['src'];
}
}
} elseif ($arCommunication["ENTITY_TYPE_ID"] == CCrmOwnerType::Company) {
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $arCommunication["ENTITY_ID"], 'CHECK_PERMISSIONS' => 'N'), false, false, array('LOGO'));
if (($arRes = $dbRes->Fetch()) && intval($arRes["LOGO"]) > 0) {
$arFileTmp = CFile::ResizeImageGet($arRes["LOGO"], array('width' => 21, 'height' => 21), BX_RESIZE_IMAGE_EXACT, false);
if (is_array($arFileTmp) && isset($arFileTmp["src"])) {
$arTmp["PHOTO"] = $arFileTmp['src'];
}
}
}
}
$arTmp["NAME"] = CCrmOwnerType::GetCaption($arCommunication["ENTITY_TYPE_ID"], $arCommunication["ENTITY_ID"], false);
$arTmp["URL"] = CCrmOwnerType::GetShowURL($arCommunication["ENTITY_TYPE_ID"], $arCommunication["ENTITY_ID"], false);
if (in_array($arCommunication["TYPE"], array('EMAIL', 'PHONE'))) {
$arTmp["COMM"] = array("TYPE" => $arCommunication["TYPE"], "VALUE" => $arCommunication["VALUE"]);
}
if (is_array($arCommunication["ENTITY_SETTINGS"]) && isset($arCommunication["ENTITY_SETTINGS"]["COMPANY_TITLE"])) {
$arTmp["COMPANY"] = $arCommunication["ENTITY_SETTINGS"]["COMPANY_TITLE"];
示例7: isset
$entityID = $arParams['ENTITY_ID'] = isset($arParams['ENTITY_ID']) ? intval($arParams['ENTITY_ID']) : 0;
if ($entityID <= 0 && isset($_GET['company_id'])) {
$entityID = $arParams['ENTITY_ID'] = intval($_GET['company_id']);
}
$arResult['ENTITY_ID'] = $entityID;
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']);
$arResult['USER_ID'] = intval(CCrmSecurityHelper::GetCurrentUserID());
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
$arParams['UID'] = 'mobile_crm_company_view';
}
$arResult['UID'] = $arParams['UID'];
$serviceURLTemplate = $arParams["SERVICE_URL_TEMPLATE"] ? $arParams["SERVICE_URL_TEMPLATE"] : '#SITE_DIR#bitrix/components/bitrix/mobile.crm.company.edit/ajax.php?site_id=#SITE#&sessid=#SID#';
$arResult['SERVICE_URL'] = CComponentEngine::makePathFromTemplate($serviceURLTemplate, array('SID' => bitrix_sessid()));
$arResult['PERMISSIONS'] = array('EDIT' => CCrmCompany::CheckUpdatePermission($entityID, $userPerms), 'DELETE' => CCrmCompany::CheckDeletePermission($entityID, $userPerms));
$dbFields = CCrmCompany::GetListEx(array(), array('ID' => $entityID));
$arFields = $dbFields->GetNext();
if (!$arFields) {
ShowError(GetMessage('CRM_COMPANY_VIEW_NOT_FOUND', array('#ID#' => $arParams['ENTITY_ID'])));
return;
}
$arResult['COMPANY_TYPE_LIST'] = CCrmStatus::GetStatusList('COMPANY_TYPE');
$arResult['EMPLOYEES_LIST'] = CCrmStatus::GetStatusList('EMPLOYEES');
$arResult['INDUSTRY_LIST'] = CCrmStatus::GetStatusList('INDUSTRY');
CCrmMobileHelper::PrepareCompanyItem($arFields, $arParams, array('COMPANY_TYPE' => $arResult['COMPANY_TYPE_LIST'], 'INDUSTRY' => $arResult['INDUSTRY_LIST'], 'EMPLOYEES_LIST' => $arResult['EMPLOYEES_LIST']));
$arFields['FM'] = array();
$dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $entityID));
if ($dbMultiFields) {
while ($multiFields = $dbMultiFields->Fetch()) {
$arFields['FM'][$multiFields['TYPE_ID']][] = array('VALUE' => $multiFields['VALUE'], 'VALUE_TYPE' => $multiFields['VALUE_TYPE']);
}
示例8: __CrmConfigPermsEndResonse
if (COption::GetOptionString('crm', '~CRM_REBUILD_COMPANY_ATTR', 'N') !== 'Y') {
__CrmConfigPermsEndResonse(array('STATUS' => 'NOT_REQUIRED', 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_NOT_REQUIRED_SUMMARY')));
}
$progressData = COption::GetOptionString('crm', '~CRM_REBUILD_COMPANY_ATTR_PROGRESS', '');
$progressData = $progressData !== '' ? unserialize($progressData) : array();
$lastItemID = isset($progressData['LAST_ITEM_ID']) ? intval($progressData['LAST_ITEM_ID']) : 0;
$processedItemQty = isset($progressData['PROCESSED_ITEMS']) ? intval($progressData['PROCESSED_ITEMS']) : 0;
$totalItemQty = isset($progressData['TOTAL_ITEMS']) ? intval($progressData['TOTAL_ITEMS']) : 0;
if ($totalItemQty <= 0) {
$totalItemQty = CCrmCompany::GetListEx(array(), array('CHECK_PERMISSIONS' => 'N'), array(), false);
}
$filter = array('CHECK_PERMISSIONS' => 'N');
if ($lastItemID > 0) {
$filter['>ID'] = $lastItemID;
}
$dbResult = CCrmCompany::GetListEx(array('ID' => 'ASC'), $filter, false, array('nTopCount' => 10), array('ID'));
$itemIDs = array();
$itemQty = 0;
if (is_object($dbResult)) {
while ($fields = $dbResult->Fetch()) {
$itemIDs[] = intval($fields['ID']);
$itemQty++;
}
}
if ($itemQty > 0) {
CCrmCompany::RebuildEntityAccessAttrs($itemIDs);
$progressData['TOTAL_ITEMS'] = $totalItemQty;
$processedItemQty += $itemQty;
$progressData['PROCESSED_ITEMS'] = $processedItemQty;
$progressData['LAST_ITEM_ID'] = $itemIDs[$itemQty - 1];
COption::SetOptionString('crm', '~CRM_REBUILD_COMPANY_ATTR_PROGRESS', serialize($progressData));
示例9: unset
}
}
unset($comm);
}
}
foreach ($imageless as $typeName => &$ids) {
if ($typeName === CCrmOwnerType::ContactName) {
$dbRes = CCrmContact::GetListEx(array(), array('@ID' => $ids), false, false, array('ID', 'PHOTO'));
while ($contact = $dbRes->Fetch()) {
$key = "CONTACT_{$contact['ID']}";
if (isset($items[$key])) {
$items[$key]['IMAGE_URL'] = CCrmMobileHelper::PrepareContactImageUrl($contact, array('WIDTH' => 40, 'HEIGHT' => 40));
}
}
} elseif ($typeName === CCrmOwnerType::CompanyName) {
$dbRes = CCrmCompany::GetListEx(array(), array('@ID' => $ids), false, false, array('ID', 'LOGO'));
while ($company = $dbRes->Fetch()) {
$key = "COMPANY_{$company['ID']}";
if (isset($items[$key])) {
$items[$key]['IMAGE_URL'] = CCrmMobileHelper::PrepareCompanyImageUrl($company, array('WIDTH' => 40, 'HEIGHT' => 40));
}
}
} elseif ($typeName === CCrmOwnerType::LeadName) {
foreach ($ids as $id) {
$key = "LEAD_{$id}";
if (isset($items[$key])) {
$items[$key]['IMAGE_URL'] = CCrmMobileHelper::GetLeadListImageStub();
}
}
}
}
示例10: EmailMessageAdd
//.........这里部分代码省略.........
}
} else {
$arCommData = array(self::CreateComm($ownerTypeID, $ownerID, $addresserInfo['EMAIL']));
}
}
}
}
$arBindingData = self::ConvertCommsToBindings($arCommData);
// Check bindings for converted leads -->
// Not Existed entities are ignored. Converted leads are ignored if their associated entities (contacts, companies, deals) are contained in bindings.
$arCorrectedBindingData = array();
$arConvertedLeadData = array();
foreach ($arBindingData as $bindingKey => &$arBinding) {
if ($arBinding['TYPE_ID'] !== CCrmOwnerType::Lead) {
if (self::IsEntityExists($arBinding['TYPE_ID'], $arBinding['ID'])) {
$arCorrectedBindingData[$bindingKey] = $arBinding;
}
continue;
}
$arFields = self::GetEntity(CCrmOwnerType::Lead, $arBinding['ID'], array('STATUS_ID'));
if (!is_array($arFields)) {
continue;
}
if (isset($arFields['STATUS_ID']) && $arFields['STATUS_ID'] === 'CONVERTED') {
$arConvertedLeadData[$bindingKey] = $arBinding;
} else {
$arCorrectedBindingData[$bindingKey] = $arBinding;
}
}
unset($arBinding);
foreach ($arConvertedLeadData as &$arConvertedLead) {
$leadID = $arConvertedLead['ID'];
$exists = false;
$dbRes = CCrmCompany::GetListEx(array(), array('LEAD_ID' => $leadID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID'));
if ($dbRes) {
while ($arRes = $dbRes->Fetch()) {
if (isset($arCorrectedBindingData[self::PrepareEntityKey(CCrmOwnerType::Company, $arRes['ID'])])) {
$exists = true;
break;
}
}
}
if ($exists) {
continue;
}
$dbRes = CCrmContact::GetListEx(array(), array('LEAD_ID' => $leadID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID'));
if ($dbRes) {
while ($arRes = $dbRes->Fetch()) {
if (isset($arCorrectedBindingData[self::PrepareEntityKey(CCrmOwnerType::Contact, $arRes['ID'])])) {
$exists = true;
break;
}
}
}
if ($exists) {
continue;
}
$dbRes = CCrmDeal::GetListEx(array(), array('LEAD_ID' => $leadID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID'));
if ($dbRes) {
while ($arRes = $dbRes->Fetch()) {
if (isset($arCorrectedBindingData[self::PrepareEntityKey(CCrmOwnerType::Deal, $arRes['ID'])])) {
$exists = true;
break;
}
}
}
示例11: GetMessage
</a>
<input type="hidden" name="value" />
</span>
<span name="report-filter-value-control-INVOICE_UTS.DEAL_BY" callback="crmDealSelector">
<a href="" class="report-select-popup-link" caller="true"><?php
echo GetMessage('REPORT_CHOOSE');
?>
</a>
<input type="hidden" name="value" />
</span>
<?php
//CCrmCompany
$arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
$obRes = CCrmCompany::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => 50), array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO'));
$arFiles = array();
$arCompanies = array();
while ($arRes = $obRes->Fetch()) {
if (!empty($arRes['LOGO']) && !isset($arFiles[$arRes['LOGO']])) {
if ($arFile = CFile::GetFileArray($arRes['LOGO'])) {
$arFiles[$arRes['LOGO']] = CHTTP::URN2URI($arFile['SRC']);
}
}
$arRes['SID'] = $arRes['ID'];
$arDesc = array();
if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
$arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
}
if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
$arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
示例12: is_array
CCrmMobileHelper::PrepareActivityItem($arFields, $arParams);
//COMMUNICATION
$arFields['CLIENT_TITLE'] = '';
$arFields['CLIENT_SHOW_URL'] = '';
$arFields['CLIENT_IMAGE_URL'] = '';
$arFields['CLIENT_LEGEND'] = '';
$arFields['CLIENT_COMPANY_TITLE'] = '';
$arFields['CLIENT_COMPANY_SHOW_URL'] = '';
$arFields['CLIENT_COMMUNICATION_VALUE'] = '';
$comm = is_array($arFields['COMMUNICATIONS']) && isset($arFields['COMMUNICATIONS'][0]) ? $arFields['COMMUNICATIONS'][0] : null;
if ($comm) {
$arFields['CLIENT_COMMUNICATION_VALUE'] = isset($comm['VALUE']) ? $comm['VALUE'] : '';
$commOwnerTypeID = isset($comm['ENTITY_TYPE_ID']) ? intval($comm['ENTITY_TYPE_ID']) : 0;
$commOwnerID = isset($comm['ENTITY_ID']) ? intval($comm['ENTITY_ID']) : 0;
if ($commOwnerTypeID === CCrmOwnerType::Company) {
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $commOwnerID), false, false, array('TITLE', 'LOGO'));
$arCompany = $dbRes ? $dbRes->Fetch() : null;
if ($arCompany) {
$arFields['CLIENT_TITLE'] = isset($arCompany['TITLE']) ? $arCompany['TITLE'] : '';
$arFields['CLIENT_SHOW_URL'] = CComponentEngine::MakePathFromTemplate($arParams['COMPANY_SHOW_URL_TEMPLATE'], array('company_id' => $commOwnerID));
$arFields['CLIENT_IMAGE_URL'] = SITE_DIR . 'bitrix/templates/mobile_app/images/crm/no_company_big.png?ver=1';
$imageID = isset($arCompany['LOGO']) ? intval($arCompany['LOGO']) : 0;
if ($imageID > 0) {
$imageInfo = CFile::ResizeImageGet($imageID, array('width' => 55, 'height' => 55), BX_RESIZE_IMAGE_EXACT);
if ($imageInfo && isset($imageInfo['src'])) {
$arFields['CLIENT_IMAGE_URL'] = $imageInfo['src'];
}
}
$arMultiFields = array();
$dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $commOwnerID));
if ($dbMultiFields) {
示例13: array
if ($arParams['arUserField']['SETTINGS']['LEAD'] == 'Y' && isset($arValue['LEAD']) && !empty($arValue['LEAD'])) {
$dbRes = CCrmLead::GetListEx(array('TITLE' => 'ASC'), array('=ID' => $arValue['LEAD']), false, false, array('ID', 'TITLE'));
while ($arRes = $dbRes->Fetch()) {
$arResult['VALUE']['LEAD'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])));
}
}
if ($arParams['arUserField']['SETTINGS']['CONTACT'] == 'Y' && isset($arValue['CONTACT']) && !empty($arValue['CONTACT'])) {
$hasNameFormatter = method_exists("CCrmContact", "PrepareFormattedName");
$dbRes = CCrmContact::GetListEx(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('=ID' => $arValue['CONTACT']), false, false, $hasNameFormatter ? array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME') : array('ID', 'FULL_NAME'));
while ($arRes = $dbRes->Fetch()) {
if ($hasNameFormatter) {
$title = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($arRes['HONORIFIC']) ? $arRes['HONORIFIC'] : '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''));
} else {
$title = isset($arRes['FULL_NAME']) ? $arRes['FULL_NAME'] : '';
}
$arResult['VALUE']['CONTACT'][$arRes['ID']] = array('ENTITY_TITLE' => $title, 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $arRes['ID'])));
}
}
if ($arParams['arUserField']['SETTINGS']['COMPANY'] == 'Y' && isset($arValue['COMPANY']) && !empty($arValue['COMPANY'])) {
$dbRes = CCrmCompany::GetListEx(array('TITLE' => 'ASC'), array('ID' => $arValue['COMPANY']));
while ($arRes = $dbRes->Fetch()) {
$arResult['VALUE']['COMPANY'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $arRes['ID'])));
}
}
if ($arParams['arUserField']['SETTINGS']['DEAL'] == 'Y' && isset($arValue['DEAL']) && !empty($arValue['DEAL'])) {
$dbRes = CCrmDeal::GetListEx(array('TITLE' => 'ASC'), array('ID' => $arValue['DEAL']));
while ($arRes = $dbRes->Fetch()) {
$arResult['VALUE']['DEAL'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID'])));
}
}
}
示例14: htmlspecialcharsbx
'desc' => htmlspecialcharsbx($arContact['COMPANY_TITLE'])
);
if (!empty($arContact['PHOTO']) && intval($arContact['PHOTO']) > 0)
{
$arImg = CFile::ResizeImageGet($arContact['PHOTO'], array('width' => 30, 'height' => 30), FX_RESIZE_IMAGE_EXACT);
$arContacts['CRMCONTACT'.$arContact['ID']]['avatar'] = $arImg['src'];
}
}
$arCompanyTypeList = CCrmStatus::GetStatusListEx('COMPANY_TYPE');
$arCompanyIndustryList = CCrmStatus::GetStatusListEx('INDUSTRY');
$dbCompanies = CCrmCompany::GetListEx(
$arOrder = array(),
$arFilter = array('%TITLE' => $search),
$arGroupBy = false,
$arNavStartParams = array('nTopCount' => 20),
$arSelectFields = array('ID', 'TITLE', 'COMPANY_TYPE', 'INDUSTRY', 'LOGO')
);
$arCompanies = array();
while ($dbCompanies && ($arCompany = $dbCompanies->fetch()))
{
$arDesc = Array();
if (isset($arCompanyTypeList[$arCompany['COMPANY_TYPE']]))
$arDesc[] = $arCompanyTypeList[$arCompany['COMPANY_TYPE']];
if (isset($arCompanyIndustryList[$arCompany['INDUSTRY']]))
$arDesc[] = $arCompanyIndustryList[$arCompany['INDUSTRY']];
$arCompanies['CRMCOMPANY'.$arCompany['ID']] = array(
'id' => 'CRMCOMPANY'.$arCompany['ID'],
'entityId' => $arCompany['ID'],
示例15: prepareRecoveryData
public static function prepareRecoveryData($entityTypeID, $entityID, array $options = null)
{
if (!is_int($entityTypeID)) {
$entityTypeID = intval($entityTypeID);
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentException('Is not defined', 'entityTypeID');
}
if (!is_int($entityID)) {
$entityID = intval($entityID);
}
if ($entityID <= 0) {
throw new Main\ArgumentException('Must be greater than zero', 'entityID');
}
if (!is_array($options)) {
$options = array();
}
$item = new EntityRecoveryData();
$item->setEntityTypeID($entityTypeID);
$item->setEntityID($entityID);
$userID = isset($options['USER_ID']) ? intval($options['USER_ID']) : 0;
if ($userID > 0) {
$item->setUserID($userID);
}
if ($entityTypeID === \CCrmOwnerType::Lead) {
$result = \CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
$fields = is_object($result) ? $result->Fetch() : null;
if (!is_array($fields)) {
throw new Main\ObjectNotFoundException("The lead with ID '{$entityTypeID}' is not found");
}
$item->setDataItem('FIELDS', $fields);
if (isset($fields['TITLE'])) {
$item->setTitle($fields['TITLE']);
}
if (isset($fields['ASSIGNED_BY_ID'])) {
$item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
}
} elseif ($entityTypeID === \CCrmOwnerType::Contact) {
$result = \CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
$fields = is_object($result) ? $result->Fetch() : null;
if (!is_array($fields)) {
throw new Main\ObjectNotFoundException("The contact with ID '{$entityTypeID}' is not found");
}
$item->setDataItem('FIELDS', $fields);
$item->setTitle(\CCrmContact::GetFullName($fields, true));
if (isset($fields['ASSIGNED_BY_ID'])) {
$item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
}
} elseif ($entityTypeID === \CCrmOwnerType::Company) {
$result = \CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
$fields = is_object($result) ? $result->Fetch() : null;
if (!is_array($fields)) {
throw new Main\ObjectNotFoundException("The company with ID '{$entityTypeID}' is not found");
}
$item->setDataItem('FIELDS', $fields);
if (isset($fields['TITLE'])) {
$item->setTitle($fields['TITLE']);
}
if (isset($fields['ASSIGNED_BY_ID'])) {
$item->setResponsibleID(intval($fields['ASSIGNED_BY_ID']));
}
} else {
throw new Main\NotSupportedException("The entity type '" . \CCrmOwnerType::ResolveName($entityTypeID) . "' is not supported in current context");
}
$entityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
//MULTI FIELDS -->
$multiFieldData = array();
$multiFieldTypes = array(\CCrmFieldMulti::PHONE, \CCrmFieldMulti::EMAIL, \CCrmFieldMulti::WEB, \CCrmFieldMulti::IM);
foreach ($multiFieldTypes as $multiFieldType) {
$result = \CCrmFieldMulti::GetListEx(array('ID' => 'ASC'), array('TYPE_ID' => $multiFieldType, 'ENTITY_ID' => $entityTypeName, 'ELEMENT_ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, array('nTopCount' => 50), array('VALUE_TYPE', 'VALUE'));
if (!is_object($result)) {
continue;
}
while ($multiFields = $result->Fetch()) {
$valueType = isset($multiFields['VALUE_TYPE']) ? $multiFields['VALUE_TYPE'] : '';
$value = isset($multiFields['VALUE']) ? $multiFields['VALUE'] : '';
if ($value === '') {
continue;
}
if (!isset($multiFieldData[$multiFieldType])) {
$multiFieldData[$multiFieldType] = array();
}
$multiFieldData[$multiFieldType][] = array('VALUE_TYPE' => $valueType, 'VALUE' => $value);
}
}
if (!empty($multiFieldData)) {
$item->setDataItem('MULTI_FIELDS', $multiFieldData);
}
//<-- MULTI FIELDS
//ACTIVITIES -->
$activityIDs = \CCrmActivity::GetBoundIDs($entityTypeID, $entityID);
if (!empty($activityIDs)) {
$item->setDataItem('ACTIVITY_IDS', $activityIDs);
}
//<-- ACTIVITIES
//EVENTS -->
$eventIDs = array();
$result = \CCrmEvent::GetListEx(array('EVENT_REL_ID' => 'ASC'), array('ENTITY_TYPE' => $entityTypeName, 'ENTITY_ID' => $entityID, 'EVENT_TYPE' => 0, 'CHECK_PERMISSIONS' => 'N'), false, false, array('EVENT_REL_ID'));
if (is_object($result)) {
while ($eventFields = $result->Fetch()) {
//.........这里部分代码省略.........