Exemple #1
0
    ShowError(GetMessage('CRM_COMPANY_VIEW_NOT_FOUND', array('#ID#' => $arParams['ENTITY_ID'])));
    return;
}
$arResult['COMPANY_TYPE_LIST'] = CCrmStatus::GetStatusList('COMPANY_TYPE');
$arResult['EMPLOYEES_LIST'] = CCrmStatus::GetStatusList('EMPLOYEES');
$arResult['INDUSTRY_LIST'] = CCrmStatus::GetStatusList('INDUSTRY');
CCrmMobileHelper::PrepareCompanyItem($arFields, $arParams, array('COMPANY_TYPE' => $arResult['COMPANY_TYPE_LIST'], 'INDUSTRY' => $arResult['INDUSTRY_LIST'], 'EMPLOYEES_LIST' => $arResult['EMPLOYEES_LIST']));
$arFields['FM'] = array();
$dbMultiFields = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'COMPANY', 'ELEMENT_ID' => $entityID));
if ($dbMultiFields) {
    while ($multiFields = $dbMultiFields->Fetch()) {
        $arFields['FM'][$multiFields['TYPE_ID']][] = array('VALUE' => $multiFields['VALUE'], 'VALUE_TYPE' => $multiFields['VALUE_TYPE']);
    }
}
$arResult['CALLTO'] = CCrmMobileHelper::PrepareCalltoParams(array('COMMUNICATION_LIST_URL_TEMPLATE' => $arParams['COMMUNICATION_LIST_URL_TEMPLATE'], 'ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $entityID, 'FM' => $arFields['FM']));
$arResult['MAILTO'] = CCrmMobileHelper::PrepareMailtoParams(array('COMMUNICATION_LIST_URL_TEMPLATE' => $arParams['COMMUNICATION_LIST_URL_TEMPLATE'], 'ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $entityID, 'FM' => $arFields['FM']));
$arFields['ACTITITY_QUANTITY'] = CAllCrmActivity::GetCount(array('BINDINGS' => array(array('OWNER_TYPE_ID' => CCrmOwnerType::Company, 'OWNER_ID' => $entityID))));
$arFields['ACTIVITY_LIST_URL'] = $arParams['ACTIVITY_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['ACTIVITY_LIST_URL_TEMPLATE'], array('entity_type_id' => CCrmOwnerType::Company, 'entity_id' => $entityID)) : '';
$arFields['EVENT_LIST_URL'] = $arParams['EVENT_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['EVENT_LIST_URL_TEMPLATE'], array('entity_type_id' => CCrmOwnerType::Company, 'entity_id' => $entityID)) : '';
$arFields['DEAL_QUANTITY'] = CAllCrmDeal::GetCount(array('COMPANY_ID' => $entityID));
$arFields['DEAL_LIST_URL'] = $arParams['DEAL_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['DEAL_LIST_URL_TEMPLATE'], array('company_id' => $entityID)) : '';
$arFields['CONTACT_QUANTITY'] = CAllCrmContact::GetCount(array('COMPANY_ID' => $entityID));
$arFields['CONTACT_LIST_URL'] = $arParams['CONTACT_LIST_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['CONTACT_LIST_URL_TEMPLATE'], array('company_id' => $entityID)) : '';
$arFields['EDIT_URL'] = $arParams['COMPANY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['COMPANY_EDIT_URL_TEMPLATE'], array('company_id' => $entityID)) : '';
$arFields['CALL_EDIT_URL'] = $arParams['ACTIVITY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_EDIT_URL_TEMPLATE'], array('owner_type' => CCrmOwnerType::CompanyName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Call)) : '';
$arFields['MEETING_EDIT_URL'] = $arParams['ACTIVITY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_EDIT_URL_TEMPLATE'], array('owner_type' => CCrmOwnerType::CompanyName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Meeting)) : '';
$arFields['EMAIL_EDIT_URL'] = $arParams['ACTIVITY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_EDIT_URL_TEMPLATE'], array('owner_type' => CCrmOwnerType::CompanyName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Email)) : '';
$arFields['INVOICE_EDIT_URL'] = $arParams['INVOICE_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['INVOICE_EDIT_URL_TEMPLATE'], array('contact_id' => '', 'company_id' => $entityID, 'deal_id' => '')) : '';
$arResult['ENTITY'] =& $arFields;
unset($arFields);
$this->IncludeComponentTemplate();
Exemple #2
0
 public static function GetStageSort($stageID)
 {
     $stageID = strval($stageID);
     if ($stageID === '') {
         return -1;
     }
     if (!self::$DEAL_STAGES) {
         self::$DEAL_STAGES = CCrmStatus::GetStatus('DEAL_STAGE');
     }
     $info = isset(self::$DEAL_STAGES[$stageID]) ? self::$DEAL_STAGES[$stageID] : null;
     return is_array($info) && isset($info['SORT']) ? intval($info['SORT']) : -1;
 }
Exemple #3
0
}
$bVarsFromForm = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid()) {
    if (isset($_POST['save']) || isset($_POST['apply'])) {
        $bConvertDeal = isset($_POST['CONVERT_DEAL']) && $_POST['CONVERT_DEAL'] == 'Y';
        $bConvertCompany = isset($_POST['CONVERT_COMPANY']) && $_POST['CONVERT_COMPANY'] == 'Y';
        $bConvertContact = isset($_POST['CONVERT_CONTACT']) && $_POST['CONVERT_CONTACT'] == 'Y';
        $arFields = array();
        $arEntity = array('CONTACT', 'COMPANY', 'DEAL');
        foreach ($arEntity as $sEntity) {
            if ($sEntity === 'CONTACT') {
                $entityFields = CAllCrmContact::GetFields();
            } elseif ($sEntity === 'COMPANY') {
                $entityFields = CAllCrmCompany::GetFields();
            } elseif ($sEntity === 'DEAL') {
                $entityFields = CAllCrmDeal::GetFields();
            } else {
                $entityFields = array();
            }
            $entityPrefix = $sEntity . '_';
            foreach ($_POST as $k => $v) {
                if (strpos($k, $entityPrefix) !== 0) {
                    continue;
                }
                $fieldKey = substr($k, strlen($entityPrefix));
                // Make an exception for CONTACT_ID and COMPANY_ID - special fields.
                if (isset($entityFields[$fieldKey]) || $sEntity === 'CONTACT' && $fieldKey === 'CONTACT_ID' || $sEntity === 'COMPANY' && $fieldKey === 'COMPANY_ID') {
                    $arFields[$sEntity][$fieldKey] = $v;
                }
            }
            $USER_FIELD_MANAGER->EditFormAddFields('CRM_' . $sEntity, $arFields[$sEntity]);