public static function GetFieldsInfo() { if (!self::$FIELD_INFOS) { self::$FIELD_INFOS = array('ID' => array('TYPE' => 'integer', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'TITLE' => array('TYPE' => 'string', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::Required)), 'COMPANY_TYPE' => array('TYPE' => 'crm_status', 'CRM_STATUS_TYPE' => 'COMPANY_TYPE'), 'LOGO' => array('TYPE' => 'file'), 'ADDRESS' => array('TYPE' => 'string'), 'ADDRESS_LEGAL' => array('TYPE' => 'string'), 'BANKING_DETAILS' => array('TYPE' => 'string'), 'INDUSTRY' => array('TYPE' => 'crm_status', 'CRM_STATUS_TYPE' => 'INDUSTRY'), 'EMPLOYEES' => array('TYPE' => 'crm_status', 'CRM_STATUS_TYPE' => 'EMPLOYEES'), 'CURRENCY_ID' => array('TYPE' => 'crm_currency'), 'REVENUE' => array('TYPE' => 'double'), 'OPENED' => array('TYPE' => 'char'), 'COMMENTS' => array('TYPE' => 'string'), 'ASSIGNED_BY_ID' => array('TYPE' => 'user'), 'CREATED_BY_ID' => array('TYPE' => 'user', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'MODIFY_BY_ID' => array('TYPE' => 'user', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'DATE_CREATE' => array('TYPE' => 'datetime', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'DATE_MODIFY' => array('TYPE' => 'datetime', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'LEAD_ID' => array('TYPE' => 'crm_lead', 'ATTRIBUTES' => array(CCrmFieldInfoAttr::ReadOnly)), 'ORIGINATOR_ID' => array('TYPE' => 'string'), 'ORIGIN_ID' => array('TYPE' => 'string')); } return self::$FIELD_INFOS; }
private static function CreateCalcTask($name, $id_company, $id_deal, $id_smart, $qw, $qp, $source) { $title_company = ''; // get company $ibc = new CAllCrmCompany(); $arFilter = array('ID' => $id_company); $res_comp = $ibc->GetList(array(), $arFilter); if ($comp_info = $res_comp->Fetch()) { $title_company = $comp_info['TITLE']; } // save $ib = new CIBlockElement(); $arFlds = array('NAME' => $name, 'IBLOCK_ID' => 65, 'ACTIVE' => 'Y'); $prod_id = $ib->Add($arFlds); // define time to process $timeStart = CArkaConstant::GetValueByName('win_start'); $timeProcess = CArkaConstant::GetValueByName('win_pos') * $qp; // ex fields if ($prod_id) { $ib->SetPropertyValueCode($prod_id, "QW", $qw); $ib->SetPropertyValueCode($prod_id, "QP", $qp); $ib->SetPropertyValueCode($prod_id, "CompanyName", $title_company); $ib->SetPropertyValueCode($prod_id, "CompanyID", $id_company); $ib->SetPropertyValueCode($prod_id, "Source", $source); $ib->SetPropertyValueCode($prod_id, "NormaStart", $timeStart); $ib->SetPropertyValueCode($prod_id, "NormaProcess", $timeProcess); } return $prod_id; }
$arResult['ELEMENT']['CONTACT']['FM'][$ar['TYPE_ID']]['n0' . $ar['ID']] = array('VALUE' => $ar['VALUE'], 'VALUE_TYPE' => $ar['VALUE_TYPE']); $arResult['ELEMENT']['COMPANY']['FM'][$ar['TYPE_ID']]['n0' . $ar['ID']] = array('VALUE' => $ar['VALUE'], 'VALUE_TYPE' => $ar['VALUE_TYPE']); } $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; }