• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CCrmDeal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getJavaScriptDescriptions

 /**
  * @return array Array of strings
  */
 public static function getJavaScriptDescriptions($checkPermissions = false)
 {
     $result = array();
     $descriptions = self::getAllDescriptions();
     if (!$checkPermissions) {
         $isInvoicePermitted = true;
         $isQuotePermitted = true;
     } else {
         $flags = array();
         \CCrmDeal::PrepareConversionPermissionFlags(0, $flags);
         $isInvoicePermitted = $flags['CAN_CONVERT_TO_INVOICE'];
         $isQuotePermitted = $flags['CAN_CONVERT_TO_QUOTE'];
     }
     if ($isInvoicePermitted && $isQuotePermitted) {
         foreach ($descriptions as $schemeID => $description) {
             $result[self::resolveName($schemeID)] = $description;
         }
     } else {
         $schemes = array();
         if ($isInvoicePermitted) {
             $schemes[] = self::INVOICE;
         }
         if ($isQuotePermitted) {
             $schemes[] = self::QUOTE;
         }
         foreach ($schemes as $schemeID) {
             $result[self::resolveName($schemeID)] = $descriptions[$schemeID];
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:34,代码来源:dealconversionscheme.php


示例2: prepareData

 /**
  * @return array
  */
 public function prepareData()
 {
     $totals = array();
     $stages = \CCrmStatus::GetStatusList('DEAL_STAGE');
     foreach ($stages as $k => $v) {
         $semanticID = \CCrmDeal::GetSemanticID($k);
         if ($semanticID === PhaseSemantics::FAILURE) {
             continue;
         }
         $totals[$k] = array('ID' => $k, 'NAME' => $v, 'TOTAL' => 0);
     }
     $source = new DealStageHistory(array(), $this->userID, $this->enablePermissionCheck);
     //CREATION
     $this->filter->setExtras(array('typeID' => HistoryEntryType::CREATION));
     $values = $source->getList(array('filter' => $this->filter));
     $this->prepareTotals($values, $totals);
     //MODIFICATION
     $this->filter->setExtras(array('typeID' => HistoryEntryType::MODIFICATION));
     $values = $source->getList(array('filter' => $this->filter));
     $this->prepareTotals($values, $totals);
     //FINALIZATION
     $this->filter->setExtras(array('typeID' => HistoryEntryType::FINALIZATION));
     $values = $source->getList(array('filter' => $this->filter));
     $this->prepareTotals($values, $totals);
     $items = array();
     foreach ($totals as $total) {
         if ($total['TOTAL'] > 0) {
             $items[] = $total;
         }
     }
     return array('items' => $items, 'valueField' => 'TOTAL', 'titleField' => 'NAME');
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:35,代码来源:dealfunnelwidget.php


示例3: rebind

 protected function rebind($seedID, $targID)
 {
     \CCrmDeal::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmQuote::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmActivity::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmLiveFeed::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmSonetRelation::RebindRelations(\CCrmOwnerType::Contact, $seedID, $targID);
     \CCrmEvent::Rebind(\CCrmOwnerType::Contact, $seedID, $targID);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:contactmerger.php


示例4: initialize

 public function initialize()
 {
     if ($this->currentPhase === DealConversionPhase::INTERMEDIATE) {
         $this->currentPhase = DealConversionPhase::INVOICE_CREATION;
     }
     if (!\CCrmDeal::Exists($this->entityID)) {
         throw new EntityConversionException(\CCrmOwnerType::Deal, \CCrmOwnerType::Undefined, EntityConversionException::TARG_SRC, EntityConversionException::NOT_FOUND);
     }
     /** @var \CCrmPerms $permissions */
     $permissions = $this->getUserPermissions();
     if (!\CCrmAuthorizationHelper::CheckReadPermission(\CCrmOwnerType::DealName, $this->entityID, $permissions)) {
         throw new EntityConversionException(\CCrmOwnerType::Deal, \CCrmOwnerType::Undefined, EntityConversionException::TARG_SRC, EntityConversionException::READ_DENIED);
     }
     if (!\CCrmAuthorizationHelper::CheckUpdatePermission(\CCrmOwnerType::DealName, $this->entityID, $permissions)) {
         throw new EntityConversionException(\CCrmOwnerType::Deal, \CCrmOwnerType::Undefined, EntityConversionException::TARG_SRC, EntityConversionException::UPDATE_DENIED);
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:dealconverter.php


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


示例6: CCrmContact

 }
 // 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'])) {
         $arProductRows = $arParams['PRODUCT_ROWS'];
         unset($arParams['PRODUCT_ROWS']);
     }
     $arParams['CURRENCY_ID'] = $currencyID;
     $dealID = $CCrmDeal->Add($arParams);
     $arDeals[$ID]['ID'] = $dealID;
     if (is_array($arProductRows)) {
         foreach ($arProductRows as &$arProductRow) {
             $originID = $arProductRow['ORIGIN_ID'];
             $arProduct = CCrmProduct::GetByOriginID($originID, $catalogID);
             if (!is_array($arProduct)) {
                 continue;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:index.php


示例7: ShowError

}
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!CCrmAuthorizationHelper::CheckReadPermission($entityTypeName, $entityID, $userPerms)) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
    $arParams['UID'] = 'mobile_crm_product_row_list';
}
$arResult['UID'] = $arParams['UID'];
$arResult['ITEMS'] = array();
$arResult['TAX_MODE'] = 'NONE';
if ($entityTypeID === CCrmOwnerType::Deal) {
    $dbRes = CCrmDeal::GetListEx(array(), array('ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('TITLE', 'CURRENCY_ID', 'OPPORTUNITY'));
    $arOwner = $dbRes ? $dbRes->Fetch() : null;
    if ($arOwner) {
        $arResult['TITLE'] = isset($arOwner['TITLE']) ? $arOwner['TITLE'] : '';
        $arResult['CURRENCY_ID'] = isset($arOwner['CURRENCY_ID']) ? $arOwner['CURRENCY_ID'] : CCrmCurrency::GetBaseCurrencyID();
        $arResult['SUM'] = isset($arOwner['OPPORTUNITY']) ? $arOwner['OPPORTUNITY'] : 0.0;
    } else {
        $arResult['TITLE'] = '';
        $arResult['CURRENCY_ID'] = CCrmCurrency::GetBaseCurrencyID();
        $arResult['SUM'] = 0.0;
    }
    $productRows = CCrmProductRow::LoadRows(CCrmOwnerTypeAbbr::Deal, $entityID);
    foreach ($productRows as &$productRow) {
        $productRow['FORMATTED_PRICE'] = CCrmCurrency::MoneyToString($productRow['PRICE'], $arResult['CURRENCY_ID']);
        $arResult['ITEMS'][] = $productRow;
    }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


示例8: isset

                 continue;
             }
             $productID = isset($arProduct['ID']) ? $arProduct['ID'] : 0;
             if ($productID <= 0) {
                 continue;
             }
             $arProductRows = array(array('PRODUCT_ID' => $productID, 'PRICE' => isset($arLead['OPPORTUNITY']) ? doubleval($arLead['OPPORTUNITY']) : 0.0, 'QUANTITY' => 1));
             CCrmLead::SaveProductRows($ID, $arProductRows);
         }
     }
     COption::SetOptionString('crm', '~crm_11_0_6_convertion', 'Y');
 }
 // <-- Convert LEAD CURRENCY and PRODUCT
 // Convert DEAL EVENTS -->
 if (COption::GetOptionString('crm', '~CRM_DEAL_EVENT_CONVERT_11_5_7', 'N') !== 'Y') {
     $dbDeals = CCrmDeal::GetListEx(array(), array('@EVENT_ID' => array('PHONE', 'INFO')), false, false, array());
     while ($arDeal = $dbDeals->Fetch()) {
         CCrmActivity::CreateFromDealEvent($arDeal);
     }
     COption::SetOptionString('crm', '~CRM_DEAL_EVENT_CONVERT_11_5_7', 'Y');
 }
 // <-- Convert DEAL EVENTS
 // SETUP DEFAULT RESPONSIBLE FOR COMPANIES-->
 if (COption::GetOptionString('crm', '~CRM_COMPANY_RESPONSIBLE_11_5_7', 'N') !== 'Y') {
     try {
         if (CCrmCompany::SetDefaultResponsible(true)) {
             COption::SetOptionString('crm', '~CRM_COMPANY_RESPONSIBLE_11_5_7', 'Y');
         }
     } catch (Exception $e) {
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:include.php


示例9: array

         $arDesc = array();
         if (isset($arCompanyTypeList[$arRes['COMPANY_TYPE']])) {
             $arDesc[] = $arCompanyTypeList[$arRes['COMPANY_TYPE']];
         }
         if (isset($arCompanyIndustryList[$arRes['INDUSTRY']])) {
             $arDesc[] = $arCompanyIndustryList[$arRes['INDUSTRY']];
         }
         $ar[] = 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' => $sSelected);
     }
     $arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
 }
 if ($arSettings['DEAL'] == 'Y' && isset($arSelected['DEAL']) && !empty($arSelected['DEAL'])) {
     $arDealStageList = CCrmStatus::GetStatusListEx('DEAL_STAGE');
     $arSelect = array('ID', 'TITLE', 'STAGE_ID', 'COMPANY_TITLE', 'CONTACT_FULL_NAME');
     $ar = array();
     $obRes = CCrmDeal::GetList(array('ID' => 'DESC'), array('ID' => $arSelected['DEAL']), $arSelect);
     while ($arRes = $obRes->Fetch()) {
         $arRes['SID'] = $arResult['PREFIX'] == 'Y' ? 'D_' . $arRes['ID'] : $arRes['ID'];
         if (isset($arResult['SELECTED'][$arRes['SID']])) {
             unset($arResult['SELECTED'][$arRes['SID']]);
             $sSelected = 'Y';
         } else {
             $sSelected = 'N';
         }
         $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
         $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
         $ar[] = array('title' => str_replace(array(';', ','), ' ', $arRes['TITLE']), 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID'])), 'type' => 'deal', 'selected' => $sSelected);
     }
     $arResult['ELEMENT'] = array_merge($ar, $arResult['ELEMENT']);
 }
 if ($arSettings['QUOTE'] == 'Y' && isset($arSelected['QUOTE']) && !empty($arSelected['QUOTE'])) {
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:result_modifier.php


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


示例11: array

$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
    $bRead = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ');
    $bExport = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'EXPORT');
    $bImport = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'IMPORT');
    $bAdd = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'ADD');
    $bWrite = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'WRITE');
    $bDelete = false;
} else {
    $bExport = false;
    $bImport = false;
    $bRead = CCrmDeal::CheckReadPermission($arParams['ELEMENT_ID'], $CrmPerms);
    $bAdd = CCrmDeal::CheckCreatePermission($CrmPerms);
    $bWrite = CCrmDeal::CheckUpdatePermission($arParams['ELEMENT_ID'], $CrmPerms);
    $bDelete = CCrmDeal::CheckDeletePermission($arParams['ELEMENT_ID'], $CrmPerms);
}
if (!$bRead && !$bAdd && !$bWrite) {
    return false;
}
if ($arParams['TYPE'] === 'list') {
    if ($bAdd) {
        $arResult['BUTTONS'][] = array('TEXT' => GetMessage('DEAL_ADD'), 'TITLE' => GetMessage('DEAL_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0)), 'HIGHLIGHT' => true);
    }
    if ($bImport) {
        $arResult['BUTTONS'][] = array('TEXT' => GetMessage('DEAL_IMPORT'), 'TITLE' => GetMessage('DEAL_IMPORT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_IMPORT'], array()), 'ICON' => 'btn-import');
    }
    if ($bExport) {
        $arResult['BUTTONS'][] = array('TITLE' => GetMessage('DEAL_EXPORT_CSV_TITLE'), 'TEXT' => GetMessage('DEAL_EXPORT_CSV'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'csv', 'ncc' => '1')), 'ICON' => 'btn-export');
        $arResult['BUTTONS'][] = array('TITLE' => GetMessage('DEAL_EXPORT_EXCEL_TITLE'), 'TEXT' => GetMessage('DEAL_EXPORT_EXCEL'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'excel', 'ncc' => '1')), 'ICON' => 'btn-export');
    }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


示例12: map

 public function map(EntityConversionMap $map, array $options = null)
 {
     $srcFields = $this->getSourceFields();
     if (empty($srcFields)) {
         return array();
     }
     $dstFields = array();
     $dstEntityTypeID = $map->getDestinationEntityTypeID();
     foreach ($map->getItems() as $item) {
         $dstFieldID = $item->getDestinationField();
         //Skip empty binding
         if ($dstFieldID === '-') {
             continue;
         }
         $srcFieldID = $item->getSourceField();
         if ((!isset($srcFields[$srcFieldID]) || $srcFields[$srcFieldID] === '') && $srcFieldID !== 'PRODUCT_ROWS') {
             $altSrcFieldID = '';
             foreach ($item->getAlternativeSourceFields() as $fieldID) {
                 if (isset($srcFields[$fieldID])) {
                     $altSrcFieldID = $fieldID;
                     break;
                 }
             }
             if ($altSrcFieldID !== '') {
                 $srcFieldID = $altSrcFieldID;
             }
         }
         if ($dstFieldID === '') {
             $dstFieldID = $srcFieldID;
         }
         if (strpos($srcFieldID, 'UF_') === 0 && strpos($dstFieldID, 'UF_') === 0) {
             self::mapUserField(\CCrmOwnerType::Deal, $srcFieldID, $srcFields, $dstEntityTypeID, $dstFieldID, $dstFields, $options);
         } elseif ($srcFieldID === 'PRODUCT_ROWS') {
             $productRows = \CCrmDeal::LoadProductRows($this->srcEntityID);
             if (count($productRows) > 0) {
                 if ($dstEntityTypeID === \CCrmOwnerType::Invoice) {
                     $currencyID = isset($srcFields['CURRENCY_ID']) ? $srcFields['CURRENCY_ID'] : '';
                     if ($currencyID === '' || !\CCrmCurrency::IsExists($currencyID)) {
                         $currencyID = \CCrmCurrency::GetBaseCurrencyID();
                     }
                     $actualRows = \CCrmInvoice::ProductRows2BasketItems($productRows, $currencyID, \CCrmInvoice::GetCurrencyID());
                     if (count($actualRows) > 0) {
                         foreach ($actualRows as &$productRow) {
                             unset($productRow['ID']);
                         }
                         unset($productRow);
                         $dstFields[$dstFieldID] = $actualRows;
                     }
                 } else {
                     foreach ($productRows as &$productRow) {
                         unset($productRow['ID']);
                     }
                     unset($productRow);
                     $dstFields[$dstFieldID] = $productRows;
                 }
             }
         } elseif (isset($srcFields[$srcFieldID])) {
             $dstFields[$dstFieldID] = $srcFields[$srcFieldID];
         }
     }
     if (!empty($dstFields)) {
         if ($dstEntityTypeID === \CCrmOwnerType::Invoice) {
             $dstFields['UF_DEAL_ID'] = $this->srcEntityID;
             //region Prepare Invoice Properties
             $dstFields['INVOICE_PROPERTIES'] = array();
             $invoiceEntity = new \CCrmInvoice(false);
             $companyID = isset($dstFields['UF_COMPANY_ID']) ? (int) $dstFields['UF_COMPANY_ID'] : 0;
             $contactID = isset($dstFields['UF_CONTACT_ID']) ? (int) $dstFields['UF_CONTACT_ID'] : 0;
             $personTypeID = 0;
             $personTypes = \CCrmPaySystem::getPersonTypeIDs();
             if ($companyID > 0 && isset($personTypes['COMPANY'])) {
                 $personTypeID = $personTypes['COMPANY'];
             } elseif (isset($personTypes['CONTACT'])) {
                 $personTypeID = $personTypes['CONTACT'];
             }
             $properties = $invoiceEntity->GetProperties(0, $personTypeID);
             if (is_array($properties)) {
                 \CCrmInvoice::__RewritePayerInfo($companyID, $contactID, $invoiceProperties);
                 foreach ($properties as $property) {
                     $dstFields['INVOICE_PROPERTIES'][$property['FIELDS']['ID']] = $property['VALUE'];
                 }
             }
             //endregion
         } elseif ($dstEntityTypeID === \CCrmOwnerType::Quote) {
             $dstFields['DEAL_ID'] = $this->srcEntityID;
         }
     }
     return $dstFields;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:89,代码来源:dealconversionmapper.php


示例13: PrepareConversionPermissionFlags

 public static function PrepareConversionPermissionFlags($ID, array &$params, $userPermissions = null)
 {
     if (!$userPermissions) {
         $userPermissions = CCrmPerms::GetCurrentUserPermissions();
     }
     $canCreateDeal = CCrmDeal::CheckCreatePermission($userPermissions);
     $canCreateInvoice = IsModuleInstalled('sale') && CCrmInvoice::CheckCreatePermission($userPermissions);
     $params['CAN_CONVERT_TO_DEAL'] = $canCreateDeal;
     $params['CAN_CONVERT_TO_INVOICE'] = $canCreateInvoice;
     $params['CAN_CONVERT'] = $params['CONVERT'] = $canCreateInvoice || $canCreateDeal;
     $restriction = \Bitrix\Crm\Restriction\RestrictionManager::getConversionRestriction();
     if ($restriction->hasPermission()) {
         $params['CONVERSION_PERMITTED'] = true;
     } else {
         $params['CONVERSION_PERMITTED'] = false;
         $params['CONVERSION_LOCK_SCRIPT'] = $restriction->preparePopupScript();
     }
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:18,代码来源:crm_quote.php


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


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


示例16: beforeViewDataQuery

 public static function beforeViewDataQuery(&$select, &$filter, &$group, &$order, &$limit, &$options, &$runtime)
 {
     // permission
     $addClause = CCrmDeal::BuildPermSql('crm_product_row_deal_owner');
     if ($addClause === false) {
         // access dinied
         $filter = array($filter, '=DEAL_OWNER.ID' => '0');
     } elseif (!empty($addClause)) {
         global $DB;
         // HACK: add escape chars for ORM
         $addClause = str_replace('crm_product_row_deal_owner.ID', $DB->escL . 'crm_product_row_deal_owner' . $DB->escR . '.ID', $addClause);
         $filter = array($filter, '=IS_ALLOWED' => '1');
         $runtime['IS_ALLOWED'] = array('data_type' => 'integer', 'expression' => array('CASE WHEN ' . $addClause . ' THEN 1 ELSE 0 END'));
         // Strongly required for permision check.
         if (!isset($select['CRM_PRODUCT_ROW_DEAL_OWNER_ID'])) {
             $select['CRM_PRODUCT_ROW_DEAL_OWNER_ID'] = 'DEAL_OWNER.ID';
         }
     }
     if (!isset($select['CRM_PRODUCT_ROW_IBLOCK_ELEMENT_ID'])) {
         $select['CRM_PRODUCT_ROW_IBLOCK_ELEMENT_ID'] = 'IBLOCK_ELEMENT.ID';
     }
     if (!isset($select['CRM_PRODUCT_ROW_IBLOCK_ELEMENT_IBLOCK_ID'])) {
         $select['CRM_PRODUCT_ROW_IBLOCK_ELEMENT_IBLOCK_ID'] = 'IBLOCK_ELEMENT.IBLOCK_ID';
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:25,代码来源:crm_report_helper.php


示例17: PreparePopupItems


//.........这里部分代码省略.........
                     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'));
             while ($arRes = $obRes->Fetch()) {
                 $arRes['SID'] = $addPrefix ? 'L_' . $arRes['ID'] : $arRes['ID'];
                 $arItems[$i] = array('title' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'desc' => CCrmLead::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), 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $arRes['ID'])), 'type' => 'lead', 'selected' => 'N');
                 $leadIndex[$arRes['ID']] =& $arItems[$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);
         } elseif ($typeName === 'DEAL') {
             $obRes = CCrmDeal::GetListEx(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'TITLE', 'STAGE_ID', 'COMPANY_TITLE', 'CONTACT_FULL_NAME'));
             while ($arRes = $obRes->Fetch()) {
                 $arRes['SID'] = $addPrefix ? 'D_' . $arRes['ID'] : $arRes['ID'];
                 $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
                 $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
                 $arItems[] = array('title' => isset($arRes['TITLE']) ? str_replace(array(';', ','), ' ', $arRes['TITLE']) : '', 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $arRes['ID'])), 'type' => 'deal', 'selected' => 'N');
             }
         } elseif ($typeName === 'QUOTE') {
             $obRes = CCrmQuote::GetList(array('ID' => 'DESC'), array(), false, array('nTopCount' => $count), array('ID', 'QUOTE_NUMBER', 'TITLE', 'COMPANY_TITLE', 'CONTACT_FULL_NAME'));
             while ($arRes = $obRes->Fetch()) {
                 $arRes['SID'] = $addPrefix ? CCrmQuote::OWNER_TYPE . '_' . $arRes['ID'] : $arRes['ID'];
                 $clientTitle = !empty($arRes['COMPANY_TITLE']) ? $arRes['COMPANY_TITLE'] : '';
                 $clientTitle .= ($clientTitle !== '' && !empty($arRes['CONTACT_FULL_NAME']) ? ', ' : '') . $arRes['CONTACT_FULL_NAME'];
                 $quoteTitle = empty($arRes['TITLE']) ? $arRes['QUOTE_NUMBER'] : $arRes['QUOTE_NUMBER'] . ' - ' . $arRes['TITLE'];
                 $arItems[] = array('title' => empty($quoteTitle) ? '' : str_replace(array(';', ','), ' ', $quoteTitle), 'desc' => $clientTitle, 'id' => $arRes['SID'], 'url' => CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_show'), array('quote_id' => $arRes['ID'])), 'type' => 'quote', 'selected' => 'N');
             }
         }
     }
     unset($typeName);
     return $arItems;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:crm_entity_selector_helper.php


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


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


示例20: unset

                $fieldName = $arMatch[1];
                if (($fieldName == 'DATE_CREATE' || $fieldName == 'DATE_MODIFY' || $fieldName == 'BEGINDATE' || $fieldName == 'CLOSEDATE') && !preg_match('/\\d{1,2}:\\d{1,2}(:\\d{1,2})?$/' . BX_UTF_PCRE_MODIFIER, $v)) {
                    $v .= ' 23:59:59';
                }
                $arFilter['<=' . $arMatch[1]] = $v;
            }
            unset($arFilter[$k]);
        } else {
            if (strpos($k, 'UF_') !== 0 && $k != 'LOGIC') {
                $arFilter['%' . $k] = $v;
                unset($arFilter[$k]);
            }
        }
    }
}
$obRes = CCrmDeal::GetListEx(array(), $arFilter, false, false, array('ID', 'TITLE', 'STAGE_ID', 'OPPORTUNITY', 'CURRENCY_ID'));
$arResult['DEAL'] = array();
$arResult['STAGE_COUNT'] = array();
$arResult['FUNNEL'] = array();
$iDealCount = 0;
while ($arDeal = $obRes->GetNext()) {
    //Normalizing for compatibil 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CCrmFieldMulti类代码示例发布时间:2022-05-23
下一篇:
PHP CCrmContact类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap