当前位置: 首页>>代码示例>>PHP>>正文


PHP CCrmFieldMulti::GetList方法代码示例

本文整理汇总了PHP中CCrmFieldMulti::GetList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmFieldMulti::GetList方法的具体用法?PHP CCrmFieldMulti::GetList怎么用?PHP CCrmFieldMulti::GetList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCrmFieldMulti的用法示例。


在下文中一共展示了CCrmFieldMulti::GetList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ExtractCommsFromEmails

 private static function ExtractCommsFromEmails($emails, $arIgnored = array())
 {
     if (!is_array($emails)) {
         $emails = array($emails);
     }
     if (count($emails) === 0) {
         return array();
     }
     $arFilter = array();
     foreach ($emails as $email) {
         //Process valid emails only
         if (!($email !== '' && CCrmMailHelper::IsEmail($email))) {
             continue;
         }
         if (in_array($email, $arIgnored, true)) {
             continue;
         }
         $arFilter[] = array('=VALUE' => $email);
     }
     if (empty($arFilter)) {
         return array();
     }
     $dbFieldMulti = CCrmFieldMulti::GetList(array(), array('ENTITY_ID' => 'LEAD|CONTACT|COMPANY', 'TYPE_ID' => 'EMAIL', 'FILTER' => $arFilter));
     $result = array();
     while ($arFieldMulti = $dbFieldMulti->Fetch()) {
         $entityTypeID = CCrmOwnerType::ResolveID($arFieldMulti['ENTITY_ID']);
         $entityID = intval($arFieldMulti['ELEMENT_ID']);
         $result[] = self::CreateComm($entityTypeID, $entityID, $arFieldMulti['VALUE']);
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:crm_email.php

示例2: getEntityMultifieldValues

 protected static function getEntityMultifieldValues($entityTypeID, $entityID, $typeID)
 {
     $results = array();
     $dbResult = \CCrmFieldMulti::GetList(array('ID' => 'asc'), array('TYPE_ID' => $typeID, 'ENTITY_ID' => \CCrmOwnerType::ResolveName($entityTypeID), 'ELEMENT_ID' => $entityID));
     if (is_object($dbResult)) {
         while ($fields = $dbResult->Fetch()) {
             $results[] = $fields['VALUE'];
         }
     }
     return $results;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:11,代码来源:datagenerator.php

示例3: getSourceMultiFields

 public function getSourceMultiFields()
 {
     if ($this->srcMultiFields !== null) {
         return $this->srcMultiFields;
     }
     $this->srcMultiFields = array();
     $dbResult = \CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'LEAD', 'ELEMENT_ID' => $this->srcEntityID));
     while ($multiField = $dbResult->Fetch()) {
         $typeID = $multiField['TYPE_ID'];
         if (!$this->srcMultiFields[$typeID]) {
             $this->srcMultiFields[$typeID] = array();
         }
         $index = count($this->srcMultiFields[$typeID]);
         $this->srcMultiFields[$typeID]["n{$index}"] = array('VALUE' => $multiField['VALUE'], 'VALUE_TYPE' => $multiField['VALUE_TYPE']);
     }
     return $this->srcMultiFields;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:leadconversionmapper.php

示例4: elseif

        } 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'];
        $url = '';
        if ($typeID === 'PHONE') {
            $url = CCrmMobileHelper::PrepareCalltoUrl($value);
        } elseif ($typeID === 'EMAIL') {
            $url = CCrmMobileHelper::PrepareMailtoUrl($value);
        }
        $arResult['ITEMS'][] = array('VALUE' => $value, 'VALUE_TYPE' => $item['VALUE_TYPE'], 'URL' => $url);
    }
}
$this->IncludeComponentTemplate();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例5: array

    $arResult['PATH_TO_CONTACT_ADD'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => 0));
    $addParams = array();
    if ($bInternal && isset($arParams['INTERNAL_CONTEXT']) && is_array($arParams['INTERNAL_CONTEXT'])) {
        $internalContext = $arParams['INTERNAL_CONTEXT'];
        if (isset($internalContext['COMPANY_ID'])) {
            $addParams['company_id'] = $internalContext['COMPANY_ID'];
        }
    }
    if (!empty($addParams)) {
        $arResult['PATH_TO_CONTACT_ADD'] = CHTTP::urlAddParams($arResult['PATH_TO_CONTACT_ADD'], $addParams);
    }
}
// adding crm multi field to result array
if (isset($arResult['CONTACT_ID']) && !empty($arResult['CONTACT_ID'])) {
    $arFmList = array();
    $res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $arResult['CONTACT_ID']));
    while ($ar = $res->Fetch()) {
        if (!$isInExportMode) {
            $arFmList[$ar['ELEMENT_ID']][$ar['COMPLEX_ID']][] = CCrmFieldMulti::GetTemplateByComplex($ar['COMPLEX_ID'], $ar['VALUE']);
        } else {
            $arFmList[$ar['ELEMENT_ID']][$ar['COMPLEX_ID']][] = $ar['VALUE'];
        }
        $arResult['CONTACT'][$ar['ELEMENT_ID']]['~' . $ar['COMPLEX_ID']][] = $ar['VALUE'];
    }
    foreach ($arFmList as $elementId => $arFM) {
        foreach ($arFM as $complexId => $arComplexName) {
            $arResult['CONTACT'][$elementId][$complexId] = implode(', ', $arComplexName);
        }
    }
    // checkig access for operation
    $arContactAttr = CCrmPerms::GetEntityAttr('CONTACT', $arResult['CONTACT_ID']);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例6: array

     }
 }
 $arSelect = array('ID', 'TITLE', 'FULL_NAME', 'STATUS_ID');
 $arOrder = array('TITLE' => 'ASC');
 $arData = array();
 $obRes = CCrmLead::GetList($arOrder, $arFilter, $arSelect, $nPageTop);
 $arFiles = array();
 $i = 0;
 $leadIndex = array();
 while ($arRes = $obRes->Fetch()) {
     $arData[$i] = array('id' => $multi ? 'L_' . $arRes['ID'] : $arRes['ID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => $arRes['FULL_NAME'], 'type' => 'lead');
     $leadIndex[$arRes['ID']] =& $arData[$i];
     $i++;
 }
 // advanced info - phone number, e-mail
 $obRes = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'LEAD', 'ELEMENT_ID' => array_keys($leadIndex)));
 while ($arRes = $obRes->Fetch()) {
     if (isset($leadIndex[$arRes['ELEMENT_ID']]) && ($arRes['TYPE_ID'] === 'PHONE' || $arRes['TYPE_ID'] === 'EMAIL')) {
         $item =& $leadIndex[$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($leadIndex);
 Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:list.ajax.php

示例7: GetCompanyFieldsByID

 public static function GetCompanyFieldsByID($pid)
 {
     $arOrder = array('DATE_CREATE' => 'DESC');
     $arFilter = array('ID' => $pid);
     $arMainFields = array();
     $arAddFields = array();
     $resList = CAllCrmCompany::GetList($arOrder, $arFilter);
     if ($arRes = $resList->Fetch()) {
         $arMainFields = $arRes;
     }
     $arFilter = array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $pid);
     $resmulti = CCrmFieldMulti::GetList(array(), $arFilter);
     while ($res1 = $resmulti->Fetch()) {
         $arMainFields[$res1["COMPLEX_ID"]] = $res1["VALUE"];
     }
     return $arMainFields;
 }
开发者ID:konvita2,项目名称:portal_php,代码行数:17,代码来源:arka_classes.php

示例8: array_keys

    $sources = array_keys($arResult['SOURCE_LIST']);
    if (!empty($sources)) {
        $arFields['~SOURCE_ID'] = $sources[0];
        $arFields['SOURCE_ID'] = htmlspecialcharsbx($arFields['~SOURCE_ID']);
    }
    CCrmMobileHelper::PrepareLeadItem($arFields, $arParams, array('STATUS_LIST' => $arResult['STATUS_LIST'], 'SOURCE_LIST' => $arResult['SOURCE_LIST']));
} else {
    $arResult['MODE'] = 'UPDATE';
    $dbFields = CCrmLead::GetListEx(array(), array('ID' => $entityID));
    $arFields = $dbFields->GetNext();
    if (!$arFields) {
        ShowError(GetMessage('CRM_LEAD_EDIT_NOT_FOUND', array('#ID#' => $arParams['ENTITY_ID'])));
        return;
    }
    $arFields['FM'] = array();
    $dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'LEAD', 'ELEMENT_ID' => $entityID));
    if ($dbMultiFields) {
        while ($arMultiField = $dbMultiFields->Fetch()) {
            $arFields['FM'][$arMultiField['TYPE_ID']][$arMultiField['ID']] = array('VALUE' => $arMultiField['VALUE'], 'VALUE_TYPE' => $arMultiField['VALUE_TYPE']);
        }
    }
    CCrmMobileHelper::PrepareLeadItem($arFields, $arParams, array('STATUS_LIST' => $arResult['STATUS_LIST'], 'SOURCE_LIST' => $arResult['SOURCE_LIST']));
}
$currencyID = $arFields['~CURRENCY_ID'];
$arResult['ENTITY'] = $arFields;
unset($arFields);
$arResult['PRODUCT_ROWS'] = $entityID > 0 ? CCrmProductRow::LoadRows('L', $entityID) : array();
foreach ($arResult['PRODUCT_ROWS'] as &$productRow) {
    $price = isset($productRow['PRICE']) ? doubleval($productRow['PRICE']) : 0.0;
    $qty = isset($productRow['QUANTITY']) ? doubleval($productRow['QUANTITY']) : 0;
    $sum = $productRow['SUM'] = $price * $qty;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例9: array

$arResult = array();
$_GET['USER_ID'] = preg_replace('/^(CONTACT|COMPANY|LEAD|DEAL)_/i' . BX_UTF_PCRE_MODIFIER, '', $_GET['USER_ID']);
$iDealId = (int) $_GET['USER_ID'];
if ($iDealId > 0) {
    __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
    $arParams['PATH_TO_DEAL_SHOW'] = CrmCheckPath('PATH_TO_DEAL_SHOW', $arParams['PATH_TO_DEAL_SHOW'], $APPLICATION->GetCurPage() . '?deal_id=#deal_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_CONTACT_SHOW'] = CrmCheckPath('PATH_TO_CONTACT_SHOW', $arParams['PATH_TO_CONTACT_SHOW'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&show');
    $arParams['PATH_TO_COMPANY_SHOW'] = CrmCheckPath('PATH_TO_COMPANY_SHOW', $arParams['PATH_TO_COMPANY_SHOW'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&show');
    $arResult['STAGE_LIST'] = CCrmStatus::GetStatusListEx('DEAL_STAGE');
    $obRes = CCrmDeal::GetList(array(), array('ID' => $iDealId));
    $arDeal = $obRes->Fetch();
    if ($arDeal == false) {
        return;
    }
    $res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'DEAL', 'ELEMENT_ID' => $iDealId));
    while ($ar = $res->Fetch()) {
        if (empty($arDeal[$ar['COMPLEX_ID']])) {
            $arDeal[$ar['COMPLEX_ID']] = CCrmFieldMulti::GetTemplateByComplex($ar['COMPLEX_ID'], $ar['VALUE']);
        }
    }
    $arDeal['PATH_TO_DEAL_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_SHOW'], array('deal_id' => $iDealId));
    $arDeal['PATH_TO_DEAL_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => $iDealId));
    $arDeal['PATH_TO_CONTACT_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $arDeal['CONTACT_ID']));
    $arDeal['PATH_TO_COMPANY_SHOW'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_SHOW'], array('company_id' => $arDeal['COMPANY_ID']));
    $arDeal['CONTACT_NAME'] = CUser::FormatName(\Bitrix\Crm\Format\PersonNameFormatter::getFormat(), array('NAME' => $arDeal['NAME'], 'LAST_NAME' => $arDeal['LAST_NAME'], 'SECOND_NAME' => $arDeal['SECOND_NAME']), true, false);
    $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">
		<a href="' . $arDeal['PATH_TO_DEAL_SHOW'] . '">' . htmlspecialcharsbx($arDeal['TITLE']) . '</a>
	</div>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:card.ajax.php

示例10: GetListItemChangesSinceToken

 public function GetListItemChangesSinceToken($listName, $viewFields = '', $query = '', $rowLimit = 0, $changeToken = '')
 {
     global $APPLICATION, $USER;
     if (!($listName_original = self::checkGUID($listName))) {
         return new CSoapFault('Data error', 'Wrong GUID - ' . $listName);
     }
     $listName = ToUpper(self::makeGUID($listName_original));
     $arFilter = array('EXPORT' => 'Y');
     $page = 1;
     $bUpdateFields = false;
     $tsLastFieldsChange = COption::GetOptionString('crm', 'ws_contacts_last_fields_change', false);
     if (strlen($changeToken) > 0) {
         if ($pos = strpos($changeToken, ';')) {
             list($newChangeToken, $page, $last_change) = explode(';', $changeToken);
             $page++;
             $changeToken = $newChangeToken;
         }
         $arFilter['>DATE_MODIFY'] = ConvertTimeStamp($changeToken, 'FULL');
         if (!$arFilter['>DATE_MODIFY']) {
             return new CSoapFault('Params error', 'Wrong changeToken: ' . $changeToken);
         }
         if ($tsLastFieldsChange !== false && $tsLastFieldsChange > $changeToken) {
             $bUpdateFields = true;
         }
     }
     CTimeZone::Disable();
     $obContact = CCrmContact::GetListEx(array(), $arFilter, false, array('nPageSize' => $rowLimit, 'bShowAll' => false, 'iNumPage' => $page));
     CTimeZone::Enable();
     if (!isset($last_change)) {
         $last_change = 0;
     }
     $data = new CXMLCreator('listitems');
     $data->setAttribute('MinTimeBetweenSyncs', 0);
     $data->setAttribute('RecommendedTimeBetweenSyncs', 180);
     $data->setAttribute('TimeStamp', $this->__makeDateTime());
     $data->setAttribute('EffectivePermMask', 'FullMask');
     $data->addChild($obChanges = new CXMLCreator('Changes'));
     if ((!$changeToken || $bUpdateFields) && $page <= 1) {
         $arGetListResult = $this->GetList($listName);
         $obChanges->addChild($arGetListResult['GetListResult']);
     }
     $data->addChild($obData = new CXMLCreator('rs:data'));
     $counter = 0;
     $arContacts = array();
     while ($arContact = $obContact->NavNext()) {
         $counter++;
         if (isset($arContact['COMPANY_TITLE'])) {
             $arContact['COMPANY'] = $arContact['COMPANY_TITLE'];
             unset($arContact['COMPANY_TITLE']);
         } else {
             $arContact['COMPANY'] = '';
         }
         $arContacts[$arContact['ID']] = $arContact;
     }
     $arCID = array_keys($arContacts);
     if (!empty($arCID)) {
         $res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'CONTACT', 'ELEMENT_ID' => $arCID));
         while ($ar = $res->Fetch()) {
             $fieldName = $ar['COMPLEX_ID'];
             if ($ar['TYPE_ID'] == 'WEB' || $ar['TYPE_ID'] == 'IM') {
                 $fieldName = $ar['TYPE_ID'];
             }
             if (empty($arContacts[$ar['ELEMENT_ID']][$fieldName])) {
                 $arContacts[$ar['ELEMENT_ID']][$fieldName] = $ar['VALUE'];
             }
         }
     }
     foreach ($arContacts as $arContact) {
         $obData->addChild($this->__getRow($arContact, $listName, $last_change));
     }
     //$last_change = time();
     $obData->setAttribute('ItemCount', $counter);
     $data->setAttribute('xmlns:rs', 'urn:schemas-microsoft-com:rowset');
     $data->setAttribute('xmlns:z', '#RowsetSchema');
     if ($bUpdateFields && $tsLastFieldsChange) {
         $last_change = $tsLastFieldsChange;
     }
     if ($last_change > 0) {
         if ($rowLimit && $obContact->NavPageCount > 1 && $obContact->NavPageCount > $page) {
             $last_change = intval($changeToken) . ';' . $page . ';' . $last_change;
             $obChanges->setAttribute('MoreChanges', 'TRUE');
         } else {
             $last_change += 1;
         }
         $obChanges->setAttribute('LastChangeToken', $last_change);
     }
     return array('GetListItemChangesSinceTokenResult' => $data);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:88,代码来源:ws_contact.php

示例11: GetCrmEntityCommunications

function GetCrmEntityCommunications($entityType, $entityID, $communicationType)
{
    $fullNameFormat = \Bitrix\Crm\Format\PersonNameFormatter::getFormat();
    if ($entityType === 'LEAD') {
        $data = array('ownerEntityType' => 'LEAD', 'ownerEntityId' => $entityID, 'entityType' => 'LEAD', 'entityId' => $entityID, 'entityTitle' => "{$entityType}_{$entityID}", 'entityDescription' => '', 'tabId' => 'main', 'communications' => array());
        $entity = CCrmLead::GetByID($entityID);
        if (!$entity) {
            return array('ERROR' => 'Invalid data');
        }
        // Prepare title
        $name = isset($entity['NAME']) ? $entity['NAME'] : '';
        $secondName = isset($entity['SECOND_NAME']) ? $entity['SECOND_NAME'] : '';
        $lastName = isset($entity['LAST_NAME']) ? $entity['LAST_NAME'] : '';
        if ($name !== '' || $secondName !== '' || $lastName !== '') {
            $data['entityTitle'] = CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $name, 'SECOND_NAME' => $secondName, 'LAST_NAME' => $lastName), false, false);
            $data['entityDescription'] = isset($entity['TITLE']) ? $entity['TITLE'] : '';
        } else {
            $data['entityTitle'] = isset($entity['TITLE']) ? $entity['TITLE'] : '';
            $data['entityDescription'] = '';
        }
        // Try to load entity communications
        if (!CCrmActivity::CheckReadPermission(CCrmOwnerType::ResolveID($entityType), $entityID)) {
            return array('ERROR' => GetMessage('CRM_PERMISSION_DENIED'));
        }
        if ($communicationType !== '') {
            $dbResFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $entityType, 'ELEMENT_ID' => $entityID, 'TYPE_ID' => $communicationType));
            while ($arField = $dbResFields->Fetch()) {
                if (empty($arField['VALUE'])) {
                    continue;
                }
                $comm = array('type' => $communicationType, 'value' => $arField['VALUE']);
                $data['communications'][] = $comm;
            }
        }
        return array('DATA' => array('TABS' => array(array('id' => 'lead', 'title' => GetMessage('CRM_COMMUNICATION_TAB_LEAD'), 'active' => true, 'items' => array($data)))));
    } elseif ($entityType === 'DEAL') {
        $entity = CCrmDeal::GetByID($entityID);
        if (!$entity) {
            return array('ERROR' => 'Invalid data');
        }
        $dealData = array();
        // Prepare company data
        $entityCompanyData = null;
        $entityCompanyID = isset($entity['COMPANY_ID']) ? intval($entity['COMPANY_ID']) : 0;
        $entityCompany = $entityCompanyID > 0 ? CCrmCompany::GetByID($entityCompanyID) : null;
        if (is_array($entityCompany)) {
            $entityCompanyData = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => 'COMPANY', 'entityId' => $entityCompanyID, 'entityTitle' => isset($entityCompany['TITLE']) ? $entityCompany['TITLE'] : '', 'entityDescription' => '', 'communications' => array());
            if ($communicationType !== '') {
                $entityCompanyComms = CCrmActivity::PrepareCommunications('COMPANY', $entityCompanyID, $communicationType);
                foreach ($entityCompanyComms as &$entityCompanyComm) {
                    $comm = array('type' => $entityCompanyComm['TYPE'], 'value' => $entityCompanyComm['VALUE']);
                    $entityCompanyData['communications'][] = $comm;
                }
                unset($entityCompanyComm);
            }
        }
        // Try to get contact of deal
        $entityContactID = isset($entity['CONTACT_ID']) ? intval($entity['CONTACT_ID']) : 0;
        if ($entityContactID > 0) {
            $entityContact = CCrmContact::GetByID($entityContactID);
            if (is_array($entityContact)) {
                $item = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => 'CONTACT', 'entityId' => $entityContactID, 'entityTitle' => CUser::FormatName($fullNameFormat, array('LOGIN' => '', 'NAME' => $entityContact['NAME'], 'LAST_NAME' => $entityContact['LAST_NAME'], 'SECOND_NAME' => $entityContact['SECOND_NAME']), false, false), 'tabId' => 'deal', 'communications' => array());
                $entityCompany = isset($entityContact['COMPANY_ID']) ? CCrmCompany::GetByID($entityContact['COMPANY_ID']) : null;
                if ($entityCompany && isset($entityCompany['TITLE'])) {
                    $item['entityDescription'] = $entityCompany['TITLE'];
                }
                if ($communicationType !== '') {
                    $entityContactComms = CCrmActivity::PrepareCommunications('CONTACT', $entityContactID, $communicationType);
                    foreach ($entityContactComms as &$entityContactComm) {
                        $comm = array('type' => $entityContactComm['TYPE'], 'value' => $entityContactComm['VALUE']);
                        $item['communications'][] = $comm;
                    }
                    unset($entityContactComm);
                }
                if ($communicationType === '' || !empty($item['communications'])) {
                    $dealData["CONTACT_{$entityContactID}"] = $item;
                }
            }
        }
        if ($entityCompanyData && !empty($entityCompanyData['communications'])) {
            $dealData['COMPANY_' . $entityCompanyID] = $entityCompanyData;
            $dealData['COMPANY_' . $entityCompanyID]['tabId'] = 'deal';
        }
        // Try to get previous communications
        $entityComms = CCrmActivity::GetCommunicationsByOwner('DEAL', $entityID, $communicationType);
        foreach ($entityComms as &$entityComm) {
            CCrmActivity::PrepareCommunicationInfo($entityComm);
            $key = "{$entityComm['ENTITY_TYPE']}_{$entityComm['ENTITY_ID']}";
            if (!isset($dealData[$key])) {
                $dealData[$key] = array('ownerEntityType' => 'DEAL', 'ownerEntityId' => $entityID, 'entityType' => CCrmOwnerType::ResolveName($entityComm['ENTITY_TYPE_ID']), 'entityId' => $entityComm['ENTITY_ID'], 'entityTitle' => isset($entityComm['TITLE']) ? $entityComm['TITLE'] : '', 'entityDescription' => isset($entityComm['DESCRIPTION']) ? $entityComm['DESCRIPTION'] : '', 'tabId' => 'deal', 'communications' => array());
            }
            if ($communicationType !== '') {
                $commFound = false;
                foreach ($dealData[$key]['communications'] as &$comm) {
                    if ($comm['value'] === $entityComm['VALUE']) {
                        $commFound = true;
                        break;
                    }
                }
                unset($comm);
//.........这里部分代码省略.........
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:101,代码来源:ajax.php

示例12: 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;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:88,代码来源:crm_search.php

示例13: unset

        }
        unset($result);
    } else {
        $entity = CCrmContact::GetByID($ownerID, false);
        if (!is_array($entity)) {
            ShowError(GetMessage('M_CRM_COMM_SELECTOR_OWNER_NOT_FOUND'));
            return;
        }
        $info = array('ENTITY_TYPE_ID' => CCrmOwnerType::Contact, 'ENTITY_ID' => $ownerID);
        if (CCrmActivity::PrepareCommunicationInfo($info, $entity)) {
            $item = array('OWNER_ID' => $ownerID, 'OWNER_TYPE_ID' => CCrmOwnerType::Contact, 'TITLE' => $info['TITLE'], 'DESCRIPTION' => $info['DESCRIPTION'], 'IMAGE_URL' => CCrmMobileHelper::PrepareContactImageUrl($entity, array('WIDTH' => 40, 'HEIGHT' => 40)), 'COMMUNICATIONS' => array());
            if ($commType === 'PERSON') {
                $items["CONTACT_{$ownerID}"] =& $item;
                unset($item);
            } else {
                $dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => CCrmOwnerType::ContactName, 'ELEMENT_ID' => $ownerID, 'TYPE_ID' => $commType));
                while ($multiField = $dbMultiFields->Fetch()) {
                    if (empty($multiField['VALUE'])) {
                        continue;
                    }
                    $item['COMMUNICATIONS'][] = array('TYPE' => $commType, 'VALUE' => $multiField['VALUE']);
                }
                if (!empty($item['COMMUNICATIONS'])) {
                    $items["CONTACT_{$ownerID}"] =& $item;
                }
                unset($item);
            }
        }
    }
} elseif ($ownerTypeID === CCrmOwnerType::Invoice) {
    if (!CCrmActivity::CheckReadPermission(CCrmOwnerType::Invoice, $ownerID)) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例14: GetMessage

        $sBodyEvent .= GetMessage('CRM_SUBSCRIBE_FROM') . ': ' . $arFields['FROM_FIELD'] . "\n\r";
        $sBodyEvent .= GetMessage('CRM_SUBSCRIBE_TO') . ': ' . $arFields['BCC_FIELD'] . "\n\r\n\r";
        $sBodyEvent .= $_POST['COMMENTS'];
        if (!empty($arEntity)) {
            $CCrmEvent->Add(array('ENTITY' => $arEntity, 'EVENT_ID' => 'MESSAGE', 'EVENT_TEXT_1' => $sBodyEvent, 'FILES' => !empty($_FILES['ATTACH']) ? $_FILES['ATTACH'] : array()));
        }
        // Try add event to entity of context
        if ($arResult['FORM_ENTITY_TYPE'] !== $arResult['ENTITY_TYPE'] && $arResult['FORM_ENTITY_ID'] !== $arResult['ENTITY_ID']) {
            $CCrmEvent->Add(array('ENTITY' => array($arResult['FORM_ENTITY_ID'] => array('ENTITY_TYPE' => $arResult['FORM_ENTITY_TYPE'], 'ENTITY_ID' => $arResult['FORM_ENTITY_ID'])), 'EVENT_ID' => 'MESSAGE', 'EVENT_TEXT_1' => $sBodyEvent, 'FILES' => !empty($_FILES['ATTACH']) ? $_FILES['ATTACH'] : array()));
        }
    }
    $arResult['EVENT_PAGE'] = CHTTP::urlAddParams($_POST['EVENT_PAGE'], array('CRM_' . trim($arResult['FORM_ENTITY_TYPE']) . '_' . trim($arParams['FORM_TYPE']) . '_active_tab' => !empty($_REQUEST['TAB_ID']) ? $_REQUEST['TAB_ID'] : 'tab_event'));
}
// check if only one is selected form the entity of a choice on which mailbox to send
$arResult['EMAIL'] = array();
if (count($arResult['ENTITY_ID']) == 1 && $arResult['ENTITY_ID'][0] > 0) {
    $arFilter = array('ENTITY_ID' => $arResult['ENTITY_TYPE'], 'TYPE_ID' => 'EMAIL', 'ELEMENT_ID' => $arResult['ENTITY_ID']);
    $obRes = CCrmFieldMulti::GetList(array('COMPLEX_ID' => 'desc', 'ID' => 'asc'), $arFilter);
    while ($arRow = $obRes->Fetch()) {
        $arResult['EMAIL']['REFERENCE'][] = CCrmFieldMulti::GetEntityNameByComplex($arRow['COMPLEX_ID']) . ': ' . $arRow['VALUE'];
        $arResult['EMAIL']['REFERENCE_ID'][] = $arRow['VALUE'];
    }
    if (isset($arResult['EMAIL']['REFERENCE'])) {
        if (count($arResult['EMAIL']['REFERENCE']) == 0) {
            $arResult['ERROR_MESSAGE'] = GetMessage('CRM_SUBSCRIBE_EMPTY_EMAIL');
        }
    } else {
        $arResult['ERROR_MESSAGE'] = GetMessage('CRM_SUBSCRIBE_EMPTY_EMAIL');
    }
}
$this->IncludeComponentTemplate();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例15: GetDocument

 public static function GetDocument($documentId)
 {
     $arDocumentID = self::GetDocumentInfo($documentId);
     if (empty($arDocumentID)) {
         throw new CBPArgumentNullException('documentId');
     }
     $arResult = null;
     switch ($arDocumentID['TYPE']) {
         case 'CONTACT':
             $dbDocumentList = CCrmContact::GetListEx(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), false, false, array('*', 'UF_*'));
             break;
         case 'COMPANY':
             $dbDocumentList = CCrmCompany::GetListEx(array(), array('ID' => $arDocumentID['ID'], 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
             break;
         case 'DEAL':
             $dbDocumentList = CCrmDeal::GetListEx(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), false, false, array('*', 'UF_*'));
             break;
         case 'LEAD':
             $dbDocumentList = CCrmLead::GetListEx(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), false, false, array('*', 'UF_*'));
             break;
     }
     if (($objDocument = $dbDocumentList->Fetch()) !== false) {
         $assignedByID = isset($objDocument['ASSIGNED_BY_ID']) ? intval($objDocument['ASSIGNED_BY_ID']) : 0;
         if ($assignedByID > 0) {
             $dbUsers = CUser::GetList($sortBy = 'id', $sortOrder = 'asc', array('ID' => $assignedByID), array('SELECT' => array('EMAIL')));
             $arUser = is_object($dbUsers) ? $dbUsers->Fetch() : null;
             $objDocument['ASSIGNED_BY_EMAIL'] = is_array($arUser) ? $arUser['EMAIL'] : '';
         }
         $arUserField = array('CREATED_BY', 'CREATED_BY_ID', 'MODIFY_BY', 'MODIFY_BY_ID', 'ASSIGNED_BY', 'ASSIGNED_BY_ID');
         foreach ($arUserField as $sField) {
             if (isset($objDocument[$sField])) {
                 $objDocument[$sField] = 'user_' . $objDocument[$sField];
             }
         }
         if (COption::GetOptionString('crm', 'bp_version', 2) == 2) {
             $userFieldsList = null;
             switch ($arDocumentID['TYPE']) {
                 case 'CONTACT':
                     $userFieldsList = CCrmContact::GetUserFields();
                     break;
                 case 'COMPANY':
                     $userFieldsList = CCrmCompany::GetUserFields();
                     break;
                 case 'DEAL':
                     $userFieldsList = CCrmDeal::GetUserFields();
                     break;
                 case 'LEAD':
                     $userFieldsList = CCrmLead::GetUserFields();
                     break;
             }
             if (is_array($userFieldsList)) {
                 foreach ($userFieldsList as $userFieldName => $userFieldParams) {
                     $fieldTypeID = isset($userFieldParams['USER_TYPE']) ? $userFieldParams['USER_TYPE']['USER_TYPE_ID'] : '';
                     $isFieldMultiple = isset($userFieldParams['MULTIPLE']) && $userFieldParams['MULTIPLE'] === 'Y';
                     $fieldSettings = isset($userFieldParams['SETTINGS']) ? $userFieldParams['SETTINGS'] : array();
                     if (isset($objDocument[$userFieldName])) {
                         $fieldValue = $objDocument[$userFieldName];
                     } elseif (isset($fieldSettings['DEFAULT_VALUE'])) {
                         $fieldValue = $fieldSettings['DEFAULT_VALUE'];
                     } else {
                         $objDocument[$userFieldName] = $objDocument[$userFieldName . '_PRINTABLE'] = '';
                         continue;
                     }
                     if ($fieldTypeID == 'employee') {
                         if (!$isFieldMultiple) {
                             $objDocument[$userFieldName] = 'user_' . $fieldValue;
                         } else {
                             $objDocument[$userFieldName] = array();
                             foreach ($fieldValue as $value) {
                                 $objDocument[$userFieldName][] = 'user_' . $value;
                             }
                         }
                     } elseif ($fieldTypeID == 'crm') {
                         $defaultTypeName = '';
                         foreach ($fieldSettings as $typeName => $flag) {
                             if ($flag === 'Y') {
                                 $defaultTypeName = $typeName;
                                 break;
                             }
                         }
                         if (!$isFieldMultiple) {
                             $objDocument[$userFieldName . '_PRINTABLE'] = self::PrepareCrmUserTypeValueView($fieldValue, $defaultTypeName);
                         } else {
                             $views = array();
                             foreach ($fieldValue as $value) {
                                 $views[] = self::PrepareCrmUserTypeValueView($value, $defaultTypeName);
                             }
                             $objDocument[$userFieldName . '_PRINTABLE'] = $views;
                         }
                     } elseif ($fieldTypeID == 'enumeration') {
                         self::ExternalizeEnumerationField($objDocument, $userFieldName);
                     } elseif ($fieldTypeID === 'boolean') {
                         //Convert UF boolean values (1/0) in to bizproc boolean values (Y/N) is display type checkbox
                         if (isset($fieldSettings['DISPLAY']) && $fieldSettings['DISPLAY'] === 'CHECKBOX') {
                             $objDocument[$userFieldName] = $fieldValue > 0 ? 'Y' : 'N';
                         }
                         $objDocument[$userFieldName . '_PRINTABLE'] = GetMessage($fieldValue > 0 ? 'MAIN_YES' : 'MAIN_NO');
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_document.php


注:本文中的CCrmFieldMulti::GetList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。