本文整理汇总了PHP中CCrmContact类的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact类的具体用法?PHP CCrmContact怎么用?PHP CCrmContact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCrmContact类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getContactInfo
protected static function getContactInfo($contactID)
{
if ($contactID <= 0) {
return array();
}
$result = array('FULL_NAME' => '', 'FULL_ADDRESS' => '', 'PHONE' => '', 'EMAIL' => '');
$dbRes = \CCrmContact::GetListEx(array(), array('=ID' => $contactID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('NAME', 'SECOND_NAME', 'LAST_NAME', '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['FULL_NAME'] = \CCrmContact::PrepareFormattedName($fields);
$result['FULL_ADDRESS'] = Format\ContactAddressFormatter::format($fields, array('SEPARATOR' => Format\AddressSeparator::NewLine));
$dbRes = \CCrmFieldMulti::GetListEx(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $contactID, '@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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:25,代码来源:datagenerator.php
示例2: getNearestEntities
public static function getNearestEntities($entityID, $currentDate, $startDate = '', $responsibleID = 0, $intervalInDays = 7, $checkPermissions = true, $limit = 5)
{
if (!is_string($startDate) || $startDate === '') {
$startDate = $currentDate;
}
$site = new \CSite();
$dateFormat = $site->GetDateFormat('SHORT');
$curretTime = $currentDate !== '' ? MakeTimeStamp($currentDate, $dateFormat) : false;
$startTime = $startDate !== '' ? MakeTimeStamp($startDate, $dateFormat) : false;
if ($startTime === false) {
return array();
}
$dt = new \DateTime();
$dt->setTimestamp($startTime);
$dt->add(new \DateInterval("P{$intervalInDays}D"));
$endTime = $dt->getTimeStamp();
$currentSorting = self::internalPrepareSorting($curretTime);
$startSorting = self::internalPrepareSorting($startTime);
$endSorting = self::internalPrepareSorting($endTime);
$result = array();
if ($entityID === \CCrmOwnerType::Lead) {
$filter = array('>=BIRTHDAY_SORT' => $startSorting, '<=BIRTHDAY_SORT' => $endSorting, 'CHECK_PERMISSIONS' => $checkPermissions ? 'Y' : 'N');
if ($responsibleID > 0) {
$filter['=ASSIGNED_BY_ID'] = $responsibleID;
}
$dbResult = \CCrmLead::GetListEx(array(), $filter, false, array('nTopCount' => $limit), array('ID', 'BIRTHDATE', 'BIRTHDAY_SORT', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME'));
while ($fields = $dbResult->Fetch()) {
$fields['ENTITY_TYPE_ID'] = \CCrmOwnerType::Lead;
$fields['IMAGE_ID'] = 0;
$sorting = isset($fields['BIRTHDAY_SORT']) ? (int) $fields['BIRTHDAY_SORT'] : 512;
$fields['IS_BIRTHDAY'] = $sorting === $currentSorting;
$result[] = $fields;
}
} elseif ($entityID === \CCrmOwnerType::Contact) {
$filter = array('>=BIRTHDAY_SORT' => $startSorting, '<=BIRTHDAY_SORT' => $endSorting, 'CHECK_PERMISSIONS' => $checkPermissions ? 'Y' : 'N');
if ($responsibleID > 0) {
$filter['=ASSIGNED_BY_ID'] = $responsibleID;
}
$dbResult = \CCrmContact::GetListEx(array(), $filter, false, array('nTopCount' => $limit), array('ID', 'BIRTHDATE', 'BIRTHDAY_SORT', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO'));
while ($fields = $dbResult->Fetch()) {
$fields['ENTITY_TYPE_ID'] = \CCrmOwnerType::Contact;
$fields['IMAGE_ID'] = isset($fields['PHOTO']) ? (int) $fields['PHOTO'] : 0;
$sorting = isset($fields['BIRTHDAY_SORT']) ? (int) $fields['BIRTHDAY_SORT'] : 512;
$fields['IS_BIRTHDAY'] = $sorting === $currentSorting;
$result[] = $fields;
}
}
return $result;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:49,代码来源:birthdayreminder.php
示例3: ResolveEntityInfo
private static function ResolveEntityInfo($typeID, $ID)
{
$typeID = intval($typeID);
$ID = intval($ID);
if (!(CCrmOwnerType::IsDefined($typeID) && $ID > 0)) {
return array('TYPE_ID' => $typeID, 'TYPE_NAME' => CCrmOwnerType::ResolveName($typeID), 'ID' => $ID);
}
$fields = null;
if ($typeID === CCrmOwnerType::Lead) {
$fields = CCrmLead::GetByID($ID, false);
} elseif ($typeID === CCrmOwnerType::Contact) {
$fields = CCrmContact::GetByID($ID, false);
} elseif ($typeID === CCrmOwnerType::Company) {
$fields = CCrmCompany::GetByID($ID, false);
} elseif ($typeID === CCrmOwnerType::Deal) {
$fields = CCrmDeal::GetByID($ID, false);
}
return array('TYPE_ID' => $typeID, 'TYPE_NAME' => CCrmOwnerType::ResolveName($typeID), 'ID' => $ID, 'FIELDS' => $fields);
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:19,代码来源:template_mapper.php
示例4: array
$arResult['CAL'][$arCal['ID'] . '_' . $sCalRel] = $arCal;
$i++;
}
if ($iAddTask != 0) {
$arResult['ROWS_COUNT'] += $iAddTask;
}
}
if ($arResult['ACTIVITY_ENTITY_LINK'] == 'Y') {
if (isset($arCalList['LEAD']) && !empty($arCalList['LEAD'])) {
$dbRes = CCrmLead::GetList(array('TITLE' => 'ASC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => array_keys($arCalList['LEAD'])));
while ($arRes = $dbRes->Fetch()) {
$arCalList['LEAD'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_LEAD_SHOW'], array('lead_id' => $arRes['ID'])));
}
}
if (isset($arCalList['CONTACT']) && !empty($arCalList['CONTACT'])) {
$dbRes = CCrmContact::GetList(array('LAST_NAME' => 'ASC', 'NAME' => 'ASC'), array('ID' => array_keys($arCalList['CONTACT'])));
while ($arRes = $dbRes->Fetch()) {
$arCalList['CONTACT'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['LAST_NAME'] . ' ' . $arRes['NAME'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arRes['ID'])));
}
}
if (isset($arCalList['COMPANY']) && !empty($arCalList['COMPANY'])) {
$dbRes = CCrmCompany::GetList(array('TITLE' => 'ASC'), array('ID' => array_keys($arCalList['COMPANY'])));
while ($arRes = $dbRes->Fetch()) {
$arCalList['COMPANY'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arRes['ID'])));
}
}
if (isset($arCalList['DEAL']) && !empty($arCalList['DEAL'])) {
$dbRes = CCrmDeal::GetList(array('TITLE' => 'ASC'), array('ID' => array_keys($arCalList['DEAL'])));
while ($arRes = $dbRes->Fetch()) {
$arCalList['DEAL'][$arRes['ID']] = array('ENTITY_TITLE' => $arRes['TITLE'], 'ENTITY_LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $arRes['ID'])));
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例5: foreach
$leadID = $CCrmLead->Add($arParams);
$arLeads[$ID]['ID'] = $leadID;
if (is_array($arProductRows)) {
foreach ($arProductRows as &$arProductRow) {
$originID = $arProductRow['ORIGIN_ID'];
$arProduct = CCrmProduct::GetByOriginID($originID, $catalogID);
if (!is_array($arProduct)) {
continue;
}
CCrmLead::SaveProductRows($leadID, array(array('PRODUCT_ID' => intval($arProduct['ID']), 'PRICE' => doubleval($arProduct['PRICE']), 'QUANTITY' => 1)));
}
}
}
// Add Contact
require_once "contact.demo.php";
$CCrmContact = new CCrmContact();
foreach ($arContacts as $ID => $arParams) {
$arContacts[$ID]['ID'] = $CCrmContact->Add($arParams);
}
// Add Company
require_once "company.demo.php";
$CCrmCompany = new CCrmCompany();
foreach ($arCompany as $ID => $arParams) {
$arCompany[$ID]['ID'] = $CCrmCompany->Add($arParams);
}
// Add Deal
require_once "deal.demo.php";
$CCrmDeal = new CCrmDeal();
foreach ($arDeals as $ID => &$arParams) {
$arProductRows = null;
if (isset($arParams['PRODUCT_ROWS'])) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:index.php
示例6: ShowError
if (IsModuleInstalled('bizproc')) {
if (!CModule::IncludeModule('bizproc')) {
ShowError(GetMessage('BIZPROC_MODULE_NOT_INSTALLED'));
return;
}
}
global $USER_FIELD_MANAGER, $USER, $APPLICATION, $DB;
$CCrmPerms = CCrmPerms::GetCurrentUserPermissions();
if ($CCrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
use Bitrix\Crm\EntityAddress;
use Bitrix\Crm\Format\AddressSeparator;
use Bitrix\Crm\Format\ContactAddressFormatter;
$CCrmContact = new CCrmContact(false);
$CCrmBizProc = new CCrmBizProc('CONTACT');
$userID = CCrmSecurityHelper::GetCurrentUserID();
$isAdmin = CCrmPerms::IsAdmin();
$arResult['CURRENT_USER_ID'] = CCrmSecurityHelper::GetCurrentUserID();
$arParams['PATH_TO_CONTACT_LIST'] = CrmCheckPath('PATH_TO_CONTACT_LIST', $arParams['PATH_TO_CONTACT_LIST'], $APPLICATION->GetCurPage());
$arParams['PATH_TO_CONTACT_SHOW'] = CrmCheckPath('PATH_TO_CONTACT_SHOW', $arParams['PATH_TO_CONTACT_SHOW'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&show');
$arParams['PATH_TO_CONTACT_EDIT'] = CrmCheckPath('PATH_TO_CONTACT_EDIT', $arParams['PATH_TO_CONTACT_EDIT'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&edit');
$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_DEAL_EDIT'] = CrmCheckPath('PATH_TO_DEAL_EDIT', $arParams['PATH_TO_DEAL_EDIT'], $APPLICATION->GetCurPage() . '?deal_id=#deal_id#&edit');
$arParams['PATH_TO_QUOTE_EDIT'] = CrmCheckPath('PATH_TO_QUOTE_EDIT', $arParams['PATH_TO_QUOTE_EDIT'], $APPLICATION->GetCurPage() . '?quote_id=#quote_id#&edit');
$arParams['PATH_TO_INVOICE_EDIT'] = CrmCheckPath('PATH_TO_INVOICE_EDIT', $arParams['PATH_TO_INVOICE_EDIT'], $APPLICATION->GetCurPage() . '?invoice_id=#invoice_id#&edit');
$arParams['PATH_TO_USER_PROFILE'] = CrmCheckPath('PATH_TO_USER_PROFILE', $arParams['PATH_TO_USER_PROFILE'], '/company/personal/user/#user_id#/');
$arParams['PATH_TO_USER_BP'] = CrmCheckPath('PATH_TO_USER_BP', $arParams['PATH_TO_USER_BP'], '/company/personal/bizproc/');
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arResult['IS_AJAX_CALL'] = isset($_REQUEST['bxajaxid']) || isset($_REQUEST['AJAX_CALL']);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例7: while
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'] = $arResult['PREFIX'] == 'Y' ? 'C_' . $arRes['ID'] : $arRes['ID'];
if (isset($arResult['SELECTED'][$arRes['SID']])) {
unset($arResult['SELECTED'][$arRes['SID']]);
$sSelected = 'Y';
} else {
$sSelected = 'N';
}
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'] : '';
}
$ar[] = array('title' => $title, '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' => $sSelected);
}
$arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
}
if ($arSettings['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' => $arSelected['COMPANY']), $arSelect);
$arFiles = array();
$ar = array();
while ($arRes = $obRes->Fetch()) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:result_modifier.php
示例8: GetEntityList
public static function GetEntityList($entityTypeID, $userID, $sortOrder, array $filter, $navParams = false)
{
$entityTypeID = (int) $entityTypeID;
$userID = (int) $userID;
$userIDs = array(0);
if ($userID > 0) {
$userIDs[] = $userID;
}
$lb = null;
if ($entityTypeID === CCrmOwnerType::Lead) {
$lb = CCrmLead::CreateListBuilder();
} else {
if ($entityTypeID === CCrmOwnerType::Deal) {
$lb = CCrmDeal::CreateListBuilder();
} else {
if ($entityTypeID === CCrmOwnerType::Contact) {
$lb = CCrmContact::CreateListBuilder();
} else {
if ($entityTypeID === CCrmOwnerType::Company) {
$lb = CCrmCompany::CreateListBuilder();
}
}
}
}
if (!$lb) {
return null;
}
$fields = $lb->GetFields();
$entityAlias = $lb->GetTableAlias();
$join = 'LEFT JOIN ' . CCrmActivity::USER_ACTIVITY_TABLE_NAME . ' UA ON UA.USER_ID IN (' . implode(',', $userIDs) . ') AND UA.OWNER_ID = ' . $entityAlias . '.ID AND UA.OWNER_TYPE_ID = ' . $entityTypeID;
$fields['ACTIVITY_USER_ID'] = array('FIELD' => 'MAX(UA.USER_ID)', 'TYPE' => 'int', 'FROM' => $join);
$fields['ACTIVITY_SORT'] = array('FIELD' => 'MAX(UA.SORT)', 'TYPE' => 'string', 'FROM' => $join);
$lb->SetFields($fields);
$sortOrder = strtoupper($sortOrder);
if ($sortOrder !== 'DESC' && $sortOrder !== 'ASC') {
$sortOrder = 'ASC';
}
$options = array('PERMISSION_SQL_TYPE' => 'FROM', 'PERMISSION_SQL_UNION' => 'DISTINCT');
return $lb->Prepare(array('ACTIVITY_USER_ID' => 'DESC', 'ACTIVITY_SORT' => $sortOrder, 'ID' => $sortOrder), $filter, array('ID'), $navParams, array('ID'), $options);
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:40,代码来源:crm_activity.php
示例9: 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'));
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_entity_selector_helper.php
示例10: GetDocumentType
public static function GetDocumentType($documentId)
{
$arDocumentID = self::GetDocumentInfo($documentId);
if (empty($arDocumentID)) {
throw new CBPArgumentNullException('documentId');
}
$exists = false;
switch ($arDocumentID['TYPE']) {
case 'CONTACT':
$exists = CCrmContact::Exists($arDocumentID['ID']);
break;
case 'COMPANY':
$exists = CCrmCompany::Exists($arDocumentID['ID']);
break;
case 'DEAL':
$exists = CCrmDeal::Exists($arDocumentID['ID']);
break;
case 'LEAD':
$exists = CCrmLead::Exists($arDocumentID['ID']);
break;
}
if (!$exists) {
throw new Exception(GetMessage('CRM_DOCUMENT_ELEMENT_IS_NOT_FOUND'));
}
return $arDocumentID['TYPE'];
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:26,代码来源:crm_document.php
示例11: RewriteClientFields
public static function RewriteClientFields(&$arFields, $bDualFields = true)
{
$arCompany = $companyEMail = $companyPhone = null;
$arContact = $contactEMail = $contactPhone = null;
$companyId = isset($arFields['COMPANY_ID']) ? intval($arFields['COMPANY_ID']) : 0;
$contactId = isset($arFields['CONTACT_ID']) ? intval($arFields['CONTACT_ID']) : 0;
if ($companyId > 0) {
$arCompany = CCrmCompany::GetByID($companyId);
// Get multifields values (EMAIL and PHONE)
$arFieldsMulti = CCrmFieldMulti::GetEntityFields('COMPANY', $companyId, 'EMAIL', true, false);
if (is_array($arFieldsMulti) && isset($arFieldsMulti[0]['VALUE'])) {
$companyEMail = $arFieldsMulti[0]['VALUE'];
}
$arFieldsMulti = CCrmFieldMulti::GetEntityFields('COMPANY', $companyId, 'PHONE', true, false);
if (is_array($arFieldsMulti) && isset($arFieldsMulti[0]['VALUE'])) {
$companyPhone = $arFieldsMulti[0]['VALUE'];
}
unset($arFieldsMulti);
}
if ($contactId > 0) {
$arContact = CCrmContact::GetByID($contactId);
// Get multifields values (EMAIL and PHONE)
$arFieldsMulti = CCrmFieldMulti::GetEntityFields('CONTACT', $contactId, 'EMAIL', true, false);
if (is_array($arFieldsMulti) && isset($arFieldsMulti[0]['VALUE'])) {
$contactEMail = $arFieldsMulti[0]['VALUE'];
}
$arFieldsMulti = CCrmFieldMulti::GetEntityFields('CONTACT', $contactId, 'PHONE', true, false);
if (is_array($arFieldsMulti) && isset($arFieldsMulti[0]['VALUE'])) {
$contactPhone = $arFieldsMulti[0]['VALUE'];
}
unset($arFieldsMulti);
}
if ($companyId > 0) {
if (is_array($arCompany) && count($arCompany) > 0) {
foreach (self::$clientFields as $k) {
$v = '';
if ($k === 'CLIENT_TITLE') {
if (isset($arCompany['TITLE'])) {
$v = $arCompany['TITLE'];
}
} elseif ($k === 'CLIENT_CONTACT' && $contactId > 0) {
if (isset($arContact['FULL_NAME'])) {
$v = $arContact['FULL_NAME'];
}
} elseif ($k === 'CLIENT_ADDR') {
$v = Bitrix\Crm\Format\CompanyAddressFormatter::format($arCompany, array('TYPE_ID' => \Bitrix\Crm\EntityAddress::Registered));
} elseif ($k === 'CLIENT_EMAIL') {
$v = $contactEMail != '' ? $contactEMail : $companyEMail;
} elseif ($k === 'CLIENT_PHONE') {
$v = $contactPhone != '' ? $contactPhone : $companyPhone;
}
if ($bDualFields) {
$arFields['~' . $k] = $v;
}
$arFields[$k] = $bDualFields ? htmlspecialcharsbx($v) : $v;
}
}
} elseif ($contactId > 0) {
if (is_array($arContact) && count($arContact) > 0) {
foreach (self::$clientFields as $k) {
$v = '';
if ($k === 'CLIENT_TITLE') {
if (isset($arContact['FULL_NAME'])) {
$v = $arContact['FULL_NAME'];
}
} elseif ($k === 'CLIENT_CONTACT' && $contactId > 0) {
$v = '';
} elseif ($k === 'CLIENT_ADDR') {
$v = Bitrix\Crm\Format\ContactAddressFormatter::format($arContact);
} elseif ($k === 'CLIENT_EMAIL') {
$v = $contactEMail;
} elseif ($k === 'CLIENT_PHONE') {
$v = $contactPhone;
}
if ($bDualFields) {
$arFields['~' . $k] = $v;
}
$arFields[$k] = $bDualFields ? htmlspecialcharsbx($v) : $v;
}
}
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:82,代码来源:crm_quote.php
示例12: TryGetInfo
public static function TryGetInfo($typeID, $ID, &$info, $bCheckPermissions = false)
{
$typeID = intval($typeID);
$ID = intval($ID);
if ($ID <= 0) {
return array();
}
$result = null;
switch ($typeID) {
case self::Lead:
$dbRes = CCrmLead::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arRes)) {
$info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
return true;
}
break;
case self::Contact:
$dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arRes)) {
$info = array('CAPTION' => CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('LOGIN' => '', 'NAME' => isset($arRes['NAME']) ? $arRes['NAME'] : '', 'SECOND_NAME' => isset($arRes['SECOND_NAME']) ? $arRes['SECOND_NAME'] : '', 'LAST_NAME' => isset($arRes['LAST_NAME']) ? $arRes['LAST_NAME'] : ''), false, false), 'IMAGE_ID' => isset($arRes['PHOTO']) ? intval($arRes['PHOTO']) : 0);
return true;
}
break;
case self::Company:
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE', 'LOGO'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arRes)) {
$info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => isset($arRes['LOGO']) ? intval($arRes['LOGO']) : 0);
return true;
}
break;
case self::Deal:
$dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arRes)) {
$info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
return true;
}
break;
case self::Invoice:
$dbRes = CCrmInvoice::GetList(array(), array('ID' => $ID), false, false, array('ORDER_TOPIC'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arRes)) {
$info = array('CAPTION' => isset($arRes['ORDER_TOPIC']) ? $arRes['ORDER_TOPIC'] : '', 'IMAGE_ID' => 0);
return true;
}
break;
case self::Quote:
$dbRes = CCrmQuote::GetList(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => $bCheckPermissions ? 'Y' : 'N'), false, false, array('TITLE'));
$arRes = $dbRes ? $dbRes->Fetch() : null;
if (is_array($arRes)) {
$info = array('CAPTION' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'IMAGE_ID' => 0);
return true;
}
break;
}
return false;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:60,代码来源:crm_owner_type.php
示例13: count
} else {
$arResult["DESCRIPTION"] = $arParams["ACTIVITY"]["DESCRIPTION"];
}
if (count($arActivity["COMMUNICATIONS"]) > 1) {
$arResult["COMMUNICATION_MORE_CNT"] = count($arActivity["COMMUNICATIONS"]) - 1;
$arResult["CLIENTS_FOR_JS"] = array();
$i = 0;
foreach ($arActivity["COMMUNICATIONS"] as $arCommunication) {
$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'];
}
}
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例14: 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'];
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:crm_document.php
示例15: fillFilterReferenceColumn
public static function fillFilterReferenceColumn(&$filterElement, &$field)
{
if ($field->getRefEntityName() == '\\Bitrix\\Crm\\Company') {
// CrmCompany
if ($filterElement['value']) {
$entity = CCrmCompany::GetById($filterElement['value']);
if ($entity) {
$filterElement['value'] = array('id' => $entity['ID'], 'name' => $entity['TITLE']);
} else {
$filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('CRM_COMPANY_NOT_FOUND'));
}
} else {
$filterElement['value'] = array('id' => '');
}
} elseif ($field->getRefEntityName() == '\\Bitrix\\Crm\\Contact') {
// CrmContact
if ($filterElement['value']) {
$entity = CCrmContact::GetById($filterElement['value']);
if ($entity) {
$filterElement['value'] = array('id' => $entity['ID'], 'name' => $entity['FULL_NAME']);
} else {
$filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('CRM_CONTACT_NOT_FOUND'));
}
} else {
$filterElement['value'] = array('id' => '');
}
} elseif ($field->getRefEntityName() == '\\Bitrix\\Crm\\Invoice') {
// CrmInvoice
if ($filterElement['value']) {
$entity = CCrmInvoice::GetById($filterElement['value']);
if ($entity) {
$filterElement['value'] = array('id' => $entity['ID'], 'name' => $entity['ORDER_TOPIC']);
} else {
$filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('CRM_INVOICE_NOT_FOUND'));
}
} else {
$filterElement['value'] = array('id' => '');
}
} elseif ($field->getRefEntityName() == '\\Bitrix\\Crm\\Deal') {
// CrmDeal
if ($filterElement['value']) {
$entity = CCrmDeal::GetById($filterElement['value']);
if ($entity) {
$filterElement['value'] = array('id' => $entity['ID'], 'name' => $entity['TITLE']);
} else {
$filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('CRM_DEAL_NOT_FOUND'));
}
} else {
$filterElement['value'] = array('id' => '');
}
} elseif ($field->getRefEntityName() == '\\Bitrix\\Crm\\Lead') {
// CrmLead
if ($filterElement['value']) {
$entity = CCrmLead::GetById($filterElement['value']);
if ($entity) {
$filterElement['value'] = array('id' => $entity['ID'], 'name' => $entity['TITLE']);
} else {
$filterElement['value'] = array('id' => $filterElement['value'], 'name' => GetMessage('CRM_LEAD_NOT_FOUND'));
}
} else {
$filterElement['value'] = array('id' => '');
}
}
parent::fillFilterReferenceColumn($filterElement, $field);
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:65,代码来源:crm_report_helper.php
示例16: 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($a
|
请发表评论