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


PHP CCrmDeal::GetByID方法代码示例

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


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

示例1: Execute

	public function Execute()
	{
		if ($this->isInEventActivityMode)
			return CBPActivityExecutionStatus::Closed;

		if ($this->DealId == null)
			return CBPActivityExecutionStatus::Closed;

		if (!CModule::IncludeModule("crm"))
			return CBPActivityExecutionStatus::Closed;

		$deal = CCrmDeal::GetByID($this->DealId, false);
		$stageSemantics = CCrmDeal::GetStageSemantics($deal['STAGE_ID']);
		if (($this->WaitForState == $deal['STAGE_ID']) || ($stageSemantics != 'process'))
		{
			$this->StageSemantics = $stageSemantics;
			return CBPActivityExecutionStatus::Closed;
		}

		$this->Subscribe($this);

		$this->WriteToTrackingService(str_replace("#DEAL#", $deal["TITLE"], GetMessage("BPCSA_TRACK")));

		$this->isInEventActivityMode = false;
		return CBPActivityExecutionStatus::Executing;
	}
开发者ID:VadimDmitriev,项目名称:Test1,代码行数:26,代码来源:crmstateactivity.php

示例2: 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

示例3: unset

         }
         unset($arLeadProducts);
         // read product row settings
         $productRowSettings = array();
         $arLeadProductRowSettings = CCrmProductRow::LoadSettings('D', $leadId);
         if (is_array($arLeadProductRowSettings)) {
             $productRowSettings['ENABLE_DISCOUNT'] = isset($arLeadProductRowSettings['ENABLE_DISCOUNT']) ? $arLeadProductRowSettings['ENABLE_DISCOUNT'] : false;
             $productRowSettings['ENABLE_TAX'] = isset($arLeadProductRowSettings['ENABLE_TAX']) ? $arLeadProductRowSettings['ENABLE_TAX'] : false;
         }
         unset($arLeadProductRowSettings);
     }
     unset($arLead);
 }
 // create from deal
 if ($dealId > 0) {
     if (($arDeal = CCrmDeal::GetByID($dealId)) && is_array($arDeal)) {
         // get lead, contact, company from deal
         if ($companyId <= 0 || $contactId <= 0) {
             if (isset($arDeal['LEAD_ID']) && intval($arDeal['LEAD_ID']) > 0) {
                 $arFields['~LEAD_ID'] = $arFields['LEAD_ID'] = intval($arDeal['LEAD_ID']);
             }
             if (isset($arDeal['CONTACT_ID']) && intval($arDeal['CONTACT_ID']) > 0) {
                 $arFields['~CONTACT_ID'] = $arFields['CONTACT_ID'] = intval($arDeal['CONTACT_ID']);
             }
             if (isset($arDeal['COMPANY_ID']) && intval($arDeal['COMPANY_ID']) > 0) {
                 $arFields['~COMPANY_ID'] = $arFields['COMPANY_ID'] = intval($arDeal['COMPANY_ID']);
             }
         }
         if (isset($arDeal['TITLE']) && !isset($arFields['~TITLE'])) {
             $arFields['~TITLE'] = $arDeal['TITLE'];
             $arFields['TITLE'] = htmlspecialcharsbx($arDeal['TITLE']);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例4: GetDealCostOriginal

 public static function GetDealCostOriginal($deal_id)
 {
     $res = 0;
     $ar = CCrmDeal::GetByID($deal_id);
     if (is_array($ar)) {
         $res = $ar['OPPORTUNITY'];
     }
     return $res;
 }
开发者ID:konvita2,项目名称:portal_php,代码行数:9,代码来源:arka_classes.php

示例5: 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

示例6: array

             continue;
         }
         $item = array('OWNER_ID' => $entityID, 'OWNER_TYPE_ID' => $entityTypeID, 'OWNER_TYPE_NAME' => $entityTypeName, 'TITLE' => $result['TITLE'], 'DESCRIPTION' => $result['DESCRIPTION'], 'IMAGE_URL' => '', 'COMMUNICATIONS' => array());
         if ($result['TYPE'] !== '' && $result['VALUE'] !== '') {
             $item['COMMUNICATIONS'][] = array('TYPE' => $result['TYPE'], 'VALUE' => $result['VALUE']);
         }
         if (!isset($imageless[$entityTypeName])) {
             $imageless[$entityTypeName] = array();
         }
         $imageless[$entityTypeName][] = $entityID;
         $items["{$entityTypeName}_{$entityID}"] =& $item;
         unset($item);
     }
     unset($result);
 } else {
     $entity = CCrmDeal::GetByID($ownerID, false);
     if (!is_array($entity)) {
         ShowError(GetMessage('M_CRM_COMM_SELECTOR_OWNER_NOT_FOUND'));
         return;
     }
     $companyID = isset($entity['COMPANY_ID']) ? intval($entity['COMPANY_ID']) : 0;
     $company = $companyID > 0 ? CCrmCompany::GetByID($companyID, true) : null;
     if (is_array($company)) {
         $info = array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $companyID);
         if (CCrmActivity::PrepareCommunicationInfo($info, $company)) {
             $companyKey = "COMPANY_{$companyID}";
             $item = array('OWNER_ID' => $companyID, 'OWNER_TYPE_ID' => CCrmOwnerType::Company, 'TITLE' => $info['TITLE'], 'DESCRIPTION' => $info['DESCRIPTION'], 'IMAGE_URL' => CCrmMobileHelper::PrepareCompanyImageUrl($company, array('WIDTH' => 40, 'HEIGHT' => 40)), 'COMMUNICATIONS' => array());
             if ($commType === 'PERSON') {
                 $items[$companyKey] =& $item;
                 unset($item);
             } else {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例7: CalculateTotalInfo

 public static function CalculateTotalInfo($ownerType, $ownerID, $checkPerms = true, $params = null, $rows = null, $totalInfo = array())
 {
     if (!is_array($totalInfo)) {
         $totalInfo = array();
     }
     $result = false;
     if (isset($totalInfo['OPPORTUNITY']) && isset($totalInfo['TAX_VALUE'])) {
         $result = array('OPPORTUNITY' => round(doubleval($totalInfo['OPPORTUNITY']), 2), 'TAX_VALUE' => round(doubleval($totalInfo['TAX_VALUE']), 2));
     } else {
         $arParams = null;
         if ($ownerID <= 0) {
             $arParams = $params;
         } else {
             if ($ownerType === 'L') {
                 $arParams = CCrmLead::GetByID($ownerID, $checkPerms);
             } elseif ($ownerType === 'D') {
                 $arParams = CCrmDeal::GetByID($ownerID, $checkPerms);
             } elseif ($ownerType === CCrmQuote::OWNER_TYPE) {
                 $arParams = CCrmQuote::GetByID($ownerID, $checkPerms);
             }
         }
         if (!is_array($arParams)) {
             return $result;
         }
         $arRows = null;
         if (is_array($rows)) {
             $arRows = $rows;
         } elseif ($ownerID > 0) {
             $arRows = CCrmProductRow::LoadRows($ownerType, $ownerID);
         }
         if (!is_array($arRows)) {
             return $result;
         }
         $currencyID = isset($params['CURRENCY_ID']) ? $params['CURRENCY_ID'] : '';
         if ($currencyID === '') {
             $currencyID = CCrmCurrency::GetBaseCurrencyID();
         }
         $companyID = isset($params['COMPANY_ID']) ? intval($params['COMPANY_ID']) : 0;
         $contactID = isset($params['CONTACT_ID']) ? intval($params['CONTACT_ID']) : 0;
         // Determine person type
         $personTypeId = 0;
         $arPersonTypes = CCrmPaySystem::getPersonTypeIDs();
         if ($companyID > 0 && isset($arPersonTypes['COMPANY'])) {
             $personTypeId = $arPersonTypes['COMPANY'];
         } elseif ($contactID > 0 && isset($arPersonTypes['CONTACT'])) {
             $personTypeId = $arPersonTypes['CONTACT'];
         }
         $enableSaleDiscount = false;
         $siteID = '';
         if (defined('SITE_ID')) {
             $siteID = SITE_ID;
         } else {
             $obSite = CSite::GetList($by = 'def', $order = 'desc', array('ACTIVE' => 'Y'));
             if ($obSite && ($arSite = $obSite->Fetch())) {
                 $siteID = $arSite["LID"];
             }
             unset($obSite, $arSite);
         }
         $calculateOptions = array();
         if (CCrmTax::isTaxMode()) {
             $calculateOptions['LOCATION_ID'] = isset($arParams['LOCATION_ID']) ? $arParams['LOCATION_ID'] : '';
         }
         $calculated = CCrmSaleHelper::Calculate($arRows, $currencyID, $personTypeId, $enableSaleDiscount, $siteID, $calculateOptions);
         $result = array('OPPORTUNITY' => isset($calculated['PRICE']) ? round(doubleval($calculated['PRICE']), 2) : 1.0, 'TAX_VALUE' => isset($calculated['TAX_VALUE']) ? round(doubleval($calculated['TAX_VALUE']), 2) : 0.0);
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:67,代码来源:crm_product_row.php

示例8: TryInternalizeCrmEntityID

 private static function TryInternalizeCrmEntityID($type, $value, &$ID)
 {
     if (preg_match('/^\\[([A-Z]+)\\]/i', $value, $m) > 0) {
         $valueType = CCrmOwnerType::Undefined;
         $prefix = strtoupper($m[1]);
         if ($prefix === 'L') {
             $valueType = CCrmOwnerType::Lead;
         } elseif ($prefix === 'C') {
             $valueType = CCrmOwnerType::Contact;
         } elseif ($prefix === 'CO') {
             $valueType = CCrmOwnerType::Company;
         } elseif ($prefix === 'D') {
             $valueType = CCrmOwnerType::Deal;
         }
         if ($valueType !== CCrmOwnerType::Undefined && $valueType !== $type) {
             return false;
         }
         $value = substr($value, strlen($m[0]));
     }
     // 1. Try to interpret data as entity ID
     // 2. Try to interpret data as entity name
     if ($type === CCrmOwnerType::Lead) {
         if (is_numeric($value)) {
             $arEntity = CCrmLead::GetByID($value);
             if ($arEntity) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
         }
         $rsEntities = CCrmLead::GetList(array(), array('=TITLE' => $value), array('ID'));
         while ($arEntity = $rsEntities->Fetch()) {
             $ID = intval($arEntity['ID']);
             return true;
         }
     } elseif ($type === CCrmOwnerType::Contact) {
         if (is_numeric($value)) {
             $arEntity = CCrmContact::GetByID($value);
             if ($arEntity) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
         }
         // Try to interpret value as FULL_NAME
         $rsEntities = CCrmContact::GetListEx(array(), array('=FULL_NAME' => $value), false, false, array('ID'));
         while ($arEntity = $rsEntities->Fetch()) {
             $ID = intval($arEntity['ID']);
             return true;
         }
         if (preg_match('/\\s*([^\\s]+)\\s+([^\\s]+)\\s*/', $value, $match) > 0) {
             // Try to interpret value as '#NAME# #LAST_NAME#'
             $rsEntities = CCrmContact::GetListEx(array(), array('=NAME' => $match[1], '=LAST_NAME' => $match[2]), false, false, array('ID'));
             while ($arEntity = $rsEntities->Fetch()) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
             // Try to interpret value as '#LAST_NAME# #NAME#'
             $rsEntities = CCrmContact::GetListEx(array(), array('=LAST_NAME' => $match[1], '=NAME' => $match[2]), false, false, array('ID'));
             while ($arEntity = $rsEntities->Fetch()) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
         } else {
             // Try to interpret value as '#LAST_NAME#'
             $rsEntities = CCrmContact::GetListEx(array(), array('=LAST_NAME' => $value), false, false, array('ID'));
             while ($arEntity = $rsEntities->Fetch()) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
         }
     } elseif ($type === CCrmOwnerType::Company) {
         if (is_numeric($value)) {
             $arEntity = CCrmCompany::GetByID($value);
             if ($arEntity) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
         }
         $rsEntities = CCrmCompany::GetList(array(), array('=TITLE' => $value), array('ID'));
         while ($arEntity = $rsEntities->Fetch()) {
             $ID = intval($arEntity['ID']);
             return true;
         }
     } elseif ($type === CCrmOwnerType::Deal) {
         if (is_numeric($value)) {
             $arEntity = CCrmDeal::GetByID($value);
             if ($arEntity) {
                 $ID = intval($arEntity['ID']);
                 return true;
             }
         }
         $rsEntities = CCrmDeal::GetList(array(), array('=TITLE' => $value), array('ID'));
         while ($arEntity = $rsEntities->Fetch()) {
             $ID = intval($arEntity['ID']);
             return true;
         }
     }
     return false;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:98,代码来源:crm_usertype.php

示例9: isset

 $ID = isset($_REQUEST['ID']) ? intval($_REQUEST['ID']) : 0;
 $typeName = isset($_REQUEST['TYPE']) ? $_REQUEST['TYPE'] : '';
 $stageID = isset($_REQUEST['VALUE']) ? $_REQUEST['VALUE'] : '';
 $targetTypeName = CCrmOwnerType::ResolveName(CCrmOwnerType::Deal);
 if ($stageID === '' || $ID <= 0 || $typeName !== $targetTypeName) {
     $APPLICATION->RestartBuffer();
     echo CUtil::PhpToJSObject(array('ERROR' => 'Invalid data!'));
     die;
 }
 $entityAttrs = $userPerms->GetEntityAttr($targetTypeName, array($ID));
 if (!$userPerms->CheckEnityAccess($targetTypeName, 'WRITE', $entityAttrs[$ID])) {
     $APPLICATION->RestartBuffer();
     echo CUtil::PhpToJSObject(array('ERROR' => 'Access denied!'));
     die;
 }
 $arFields = CCrmDeal::GetByID($ID, false);
 if (!is_array($arFields)) {
     $APPLICATION->RestartBuffer();
     echo CUtil::PhpToJSObject(array('ERROR' => 'Not found!'));
     die;
 }
 if (isset($arFields['CREATED_BY_ID'])) {
     unset($arFields['CREATED_BY_ID']);
 }
 if (isset($arFields['DATE_CREATE'])) {
     unset($arFields['DATE_CREATE']);
 }
 if (isset($arFields['MODIFY_BY_ID'])) {
     unset($arFields['MODIFY_BY_ID']);
 }
 if (isset($arFields['DATE_MODIFY'])) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:list.ajax.php


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