本文整理汇总了PHP中CCrmOwnerType::IsDefined方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmOwnerType::IsDefined方法的具体用法?PHP CCrmOwnerType::IsDefined怎么用?PHP CCrmOwnerType::IsDefined使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmOwnerType
的用法示例。
在下文中一共展示了CCrmOwnerType::IsDefined方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($entityTypeID, $seedID, $targID, $typeID)
{
if (!is_int($entityTypeID)) {
$entityTypeID = (int) $entityTypeID;
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentException('Is not defined', 'entityTypeID');
}
$this->entityTypeID = $entityTypeID;
if (!is_int($seedID)) {
$seedID = (int) $seedID;
}
if ($seedID <= 0) {
throw new Main\ArgumentException('Must be greater than zero', 'seedID');
}
$this->seedID = $seedID;
if (!is_int($targID)) {
$targID = (int) $targID;
}
if ($targID <= 0) {
throw new Main\ArgumentException('Must be greater than zero', 'targID');
}
$this->targID = $targID;
if (!is_int($typeID)) {
$typeID = (int) $typeID;
}
if (!self::isTypeDefined($typeID)) {
throw new Main\ArgumentException('Is not defined', 'typeID');
}
$this->typeID = $typeID;
}
示例2: __construct
public function __construct($entityTypeID, $userID, $enablePermissionCheck = false)
{
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentException('Is not defined', 'entityTypeID');
}
$this->entityTypeID = $entityTypeID;
$this->setUserID($userID);
$this->enabledPermissionCheck($enablePermissionCheck);
}
示例3: __construct
protected function __construct($entityTypeID)
{
if (!is_int($entityTypeID)) {
throw new Main\ArgumentTypeException('entityTypeID', 'integer');
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\NotSupportedException("Entity ID: '{$entityTypeID}' is not supported in current context");
}
$this->entityTypeID = $entityTypeID;
}
示例4: createMap
/**
* Create conversion map for destination entity type
* @static
* @param int $entityTypeID Destination Entity Type ID
* @return EntityConversionMap
*/
public static function createMap($entityTypeID)
{
if (!is_int($entityTypeID)) {
$entityTypeID = (int) $entityTypeID;
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentOutOfRangeException('dstEntityTypeID', \CCrmOwnerType::FirstOwnerType, \CCrmOwnerType::LastOwnerType);
}
if ($entityTypeID !== \CCrmOwnerType::Deal && $entityTypeID !== \CCrmOwnerType::Invoice) {
$dstEntityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
throw new Main\NotSupportedException("Entity type: '{$dstEntityTypeName}' is not supported in current context");
}
$map = new EntityConversionMap(\CCrmOwnerType::Quote, $entityTypeID);
if ($entityTypeID === \CCrmOwnerType::Deal) {
//region Deal Map Static Field Bindings
$map->createItem('TITLE');
$map->createItem('COMMENTS');
$map->createItem('ASSIGNED_BY_ID');
$map->createItem('OPENED');
$map->createItem('OPPORTUNITY');
$map->createItem('CURRENCY_ID');
$map->createItem('TAX_VALUE');
$map->createItem('EXCH_RATE');
$map->createItem('LOCATION_ID');
$map->createItem('LEAD_ID');
$map->createItem('COMPANY_ID');
$map->createItem('CONTACT_ID');
$map->createItem('PRODUCT_ROWS');
//endregion
//region Invoice Map User Field Bindings
$intersections = UserFieldSynchronizer::getIntersection(\CCrmOwnerType::Quote, \CCrmOwnerType::Deal);
foreach ($intersections as $intersection) {
$map->createItem($intersection['SRC_FIELD_NAME'], $intersection['DST_FIELD_NAME']);
}
//endregion
}
if ($entityTypeID === \CCrmOwnerType::Invoice) {
//region Invoice Map Static Field Bindings
$map->createItem('TITLE', 'ORDER_TOPIC');
$map->createItem('COMPANY_ID', 'UF_COMPANY_ID');
$map->createItem('CONTACT_ID', 'UF_CONTACT_ID');
$map->createItem('DEAL_ID', 'UF_DEAL_ID');
$map->createItem('ASSIGNED_BY_ID', 'RESPONSIBLE_ID');
$map->createItem('COMMENTS');
$map->createItem('PRODUCT_ROWS');
//endregion
//region Invoice Map User Field Bindings
$intersections = UserFieldSynchronizer::getIntersection(\CCrmOwnerType::Quote, \CCrmOwnerType::Invoice);
foreach ($intersections as $intersection) {
$map->createItem($intersection['SRC_FIELD_NAME'], $intersection['DST_FIELD_NAME']);
}
//endregion
}
return $map;
}
示例5: setEntityTypeID
public function setEntityTypeID($entityTypeID)
{
if (!is_integer($entityTypeID)) {
$entityTypeID = intval($entityTypeID);
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
$entityTypeID = \CCrmOwnerType::Undefined;
}
if ($this->entityTypeID === $entityTypeID) {
return;
}
$this->entityTypeID = $entityTypeID;
}
示例6: __construct
public function __construct($srcEntityTypeID, $srcEntityID)
{
if (!is_int($srcEntityTypeID)) {
$srcEntityTypeID = (int) $srcEntityTypeID;
}
if (!\CCrmOwnerType::IsDefined($srcEntityTypeID)) {
throw new Main\ArgumentOutOfRangeException('srcEntityTypeID', \CCrmOwnerType::FirstOwnerType, \CCrmOwnerType::LastOwnerType);
}
$this->srcEntityTypeID = $srcEntityTypeID;
if (!is_int($srcEntityID)) {
$srcEntityID = (int) $srcEntityID;
}
if ($srcEntityID <= 0) {
throw new Main\ArgumentException('Owner ID must be greater than zero.', 'srcEntityID');
}
$this->srcEntityID = $srcEntityID;
}
示例7: GetDefaultGrigID
public static function GetDefaultGrigID($entityTypeID)
{
$entityTypeID = (int) $entityTypeID;
if (!CCrmOwnerType::IsDefined($entityTypeID)) {
return '';
}
if ($entityTypeID === CCrmOwnerType::Lead) {
return 'CRM_LEAD_LIST_V12';
} elseif ($entityTypeID === CCrmOwnerType::Deal) {
return 'CRM_DEAL_LIST_V12';
} elseif ($entityTypeID === CCrmOwnerType::Contact) {
return 'CRM_CONTACT_LIST_V12';
} elseif ($entityTypeID === CCrmOwnerType::Company) {
return 'CRM_COMPANY_LIST_V12';
}
return '';
}
示例8: deleteByEntity
public static function deleteByEntity($entityTypeID, $entityID)
{
if (!is_int($entityTypeID)) {
$entityTypeID = (int) $entityTypeID;
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentException("Is not defined or invalid", 'entityTypeID');
}
if (!is_int($entityID)) {
$entityID = (int) $entityID;
}
if ($entityID <= 0) {
throw new Main\ArgumentException("Must be greater than zero", 'entityID');
}
$connection = Main\Application::getConnection();
$connection->queryExecute("DELETE FROM b_crm_dp_index_mismatch WHERE ENTITY_TYPE_ID = {$entityTypeID} AND L_ENTITY_ID = {$entityID}");
$connection->queryExecute("DELETE FROM b_crm_dp_index_mismatch WHERE ENTITY_TYPE_ID = {$entityTypeID} AND R_ENTITY_ID = {$entityID}");
}
示例9: create
/** Create new entity merger by specified entity type ID
* @static
* @param int $entityTypeID
* @param int $currentUserID
* @param bool $enablePermissionCheck
* @return EntityMerger
*/
public static function create($entityTypeID, $currentUserID, $enablePermissionCheck = false)
{
if (!is_int($entityTypeID)) {
$entityTypeID = (int) $entityTypeID;
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentException('Is not defined', 'entityTypeID');
}
if ($entityTypeID === \CCrmOwnerType::Lead) {
return new LeadMerger($currentUserID, $enablePermissionCheck);
} elseif ($entityTypeID === \CCrmOwnerType::Contact) {
return new ContactMerger($currentUserID, $enablePermissionCheck);
} elseif ($entityTypeID === \CCrmOwnerType::Company) {
return new CompanyMerger($currentUserID, $enablePermissionCheck);
} else {
throw new Main\NotSupportedException("Entity type: '" . \CCrmOwnerType::ResolveName($entityTypeID) . "' is not supported in current context");
}
}
示例10: 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);
}
示例11: enabledFor
public function enabledFor($entityTypeID, $enable)
{
if (!is_int($entityTypeID)) {
throw new Main\ArgumentTypeException('entityTypeID', 'integer');
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\NotSupportedException("Entity ID: '{$entityTypeID}' is not supported in current context");
}
if (!is_bool($enable)) {
if (is_numeric($enable)) {
$enable = $enable > 0;
} elseif (is_string($enable)) {
$enable = strtoupper($enable) === 'Y';
} else {
$enable = false;
}
}
$this->settings['enableFor'][\CCrmOwnerType::ResolveName($entityTypeID)] = $enable ? 'Y' : 'N';
}
示例12: create
public static function create(array $fields = null, $sourceEntityTypeID = \CCrmOwnerType::Undefined, $destinationEntityTypeID = \CCrmOwnerType::Undefined)
{
if (!is_int($sourceEntityTypeID)) {
throw new Main\ArgumentTypeException('sourceEntityTypeID', 'integer');
}
if (!is_int($destinationEntityTypeID)) {
throw new Main\ArgumentTypeException('destinationEntityTypeID', 'integer');
}
if ($sourceEntityTypeID !== \CCrmOwnerType::Undefined && !\CCrmOwnerType::IsDefined($sourceEntityTypeID)) {
$sourceEntityTypeID = \CCrmOwnerType::Undefined;
}
if ($destinationEntityTypeID !== \CCrmOwnerType::Undefined && !\CCrmOwnerType::IsDefined($destinationEntityTypeID)) {
$destinationEntityTypeID = \CCrmOwnerType::Undefined;
}
if (\CCrmOwnerType::IsDefined($sourceEntityTypeID) && !\CCrmOwnerType::IsDefined($destinationEntityTypeID)) {
$destinationEntityTypeID = $sourceEntityTypeID;
}
$adapter = null;
if ($sourceEntityTypeID !== \CCrmOwnerType::Undefined && $destinationEntityTypeID !== \CCrmOwnerType::Undefined) {
if ($sourceEntityTypeID === \CCrmOwnerType::Lead) {
if ($destinationEntityTypeID === \CCrmOwnerType::Company) {
$adapter = new EntityAdapter(\CCrmOwnerType::Lead, \CCrmOwnerType::Company, new Mapper(array('COMPANY_TITLE' => 'TITLE')));
}
} elseif ($sourceEntityTypeID === \CCrmOwnerType::Company) {
if ($destinationEntityTypeID === \CCrmOwnerType::Lead) {
$adapter = new EntityAdapter(\CCrmOwnerType::Company, \CCrmOwnerType::Lead, new Mapper(array('TITLE' => 'COMPANY_TITLE')));
}
}
}
if ($adapter === null) {
$adapter = new EntityAdapter($sourceEntityTypeID, $destinationEntityTypeID);
}
if ($fields !== null) {
$adapter->setFields($fields);
}
return $adapter;
}
示例13: GetTypeMap
public function GetTypeMap($typeID)
{
$typeID = intval($typeID);
if (!CCrmOwnerType::IsDefined($typeID)) {
return null;
}
if (!isset(self::$MAP_BY_LANG[LANGUAGE_ID])) {
self::$MAP_BY_LANG[LANGUAGE_ID] = array();
}
if (isset(self::$MAP_BY_LANG[LANGUAGE_ID][$typeID])) {
return self::$MAP_BY_LANG[LANGUAGE_ID][$typeID];
}
IncludeModuleLangFile(__FILE__);
if ($typeID === CCrmOwnerType::Lead) {
return self::$MAP_BY_LANG[LANGUAGE_ID][CCrmOwnerType::Lead] = array('typeId' => CCrmOwnerType::Lead, 'typeName' => CCrmOwnerType::ResolveName(CCrmOwnerType::Lead), 'fields' => array(array('id' => 'ID', 'name' => 'ID'), array('id' => 'TITLE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_TITLE')), array('id' => 'LAST_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_LAST_NAME')), array('id' => 'NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_NAME')), array('id' => 'SECOND_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_SECOND_NAME')), array('id' => 'FORMATTED_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_FORMATTED_NAME')), array('id' => 'COMPANY_TITLE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMPANY_TITLE')), array('id' => 'SOURCE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_SOURCE')), array('id' => 'SOURCE_DESCRIPTION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_SOURCE_DESCRIPTION')), array('id' => 'STATUS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_STATUS')), array('id' => 'STATUS_DESCRIPTION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_STATUS_DESCRIPTION')), array('id' => 'POST', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_POST')), array('id' => 'ADDRESS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ADDRESS')), array('id' => 'CURRENCY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CURRENCY')), array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_OPPORTUNITY')), array('id' => 'OPPORTUNITY_FORMATTED', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_OPPORTUNITY_FORMATTED')), array('id' => 'ASSIGNED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_FULL_NAME')), array('id' => 'ASSIGNED_BY_WORK_POSITION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_POST')), array('id' => 'CREATED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CREATED_BY_FULL_NAME')), array('id' => 'MODIFY_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_MODIFY_BY_FULL_NAME')), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_CREATE')), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_MODIFY')), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMMENTS'))));
} elseif ($typeID === CCrmOwnerType::Deal) {
return self::$MAP_BY_LANG[LANGUAGE_ID][CCrmOwnerType::Deal] = array('typeId' => CCrmOwnerType::Deal, 'typeName' => CCrmOwnerType::ResolveName(CCrmOwnerType::Deal), 'fields' => array(array('id' => 'ID', 'name' => 'ID'), array('id' => 'TITLE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_TITLE')), array('id' => 'TYPE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_TYPE')), array('id' => 'STAGE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_STAGE')), array('id' => 'PROBABILITY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_PROBABILITY')), array('id' => 'CURRENCY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CURRENCY')), array('id' => 'OPPORTUNITY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_OPPORTUNITY')), array('id' => 'OPPORTUNITY_FORMATTED', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_OPPORTUNITY_FORMATTED')), array('id' => 'COMPANY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMPANY'), 'typeId' => CCrmOwnerType::Company), array('id' => 'CONTACT', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CONTACT'), 'typeId' => CCrmOwnerType::Contact), array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_BEGINDATE')), array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CLOSEDATE')), array('id' => 'ASSIGNED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_FULL_NAME')), array('id' => 'ASSIGNED_BY_WORK_POSITION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_POST')), array('id' => 'CREATED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CREATED_BY_FULL_NAME')), array('id' => 'MODIFY_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_MODIFY_BY_FULL_NAME')), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_CREATE')), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_MODIFY')), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMMENTS'))));
} elseif ($typeID === CCrmOwnerType::Contact) {
return self::$MAP_BY_LANG[LANGUAGE_ID][CCrmOwnerType::Contact] = array('typeId' => CCrmOwnerType::Contact, 'typeName' => CCrmOwnerType::ResolveName(CCrmOwnerType::Contact), 'fields' => array(array('id' => 'ID', 'name' => 'ID'), array('id' => 'LAST_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_LAST_NAME')), array('id' => 'NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_NAME')), array('id' => 'SECOND_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_SECOND_NAME')), array('id' => 'FORMATTED_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_FORMATTED_NAME')), array('id' => 'POST', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_POST')), array('id' => 'ADDRESS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ADDRESS')), array('id' => 'TYPE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_TYPE')), array('id' => 'SOURCE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_SOURCE')), array('id' => 'SOURCE_DESCRIPTION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_STATUS_DESCRIPTION')), array('id' => 'COMPANY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMPANY'), 'typeId' => CCrmOwnerType::Company), array('id' => 'ASSIGNED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_FULL_NAME')), array('id' => 'ASSIGNED_BY_WORK_POSITION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_POST')), array('id' => 'CREATED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CREATED_BY_FULL_NAME')), array('id' => 'MODIFY_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_MODIFY_BY_FULL_NAME')), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_CREATE')), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_MODIFY')), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMMENTS'))));
} elseif ($typeID === CCrmOwnerType::Company) {
return self::$MAP_BY_LANG[LANGUAGE_ID][CCrmOwnerType::Company] = array('typeId' => CCrmOwnerType::Company, 'typeName' => CCrmOwnerType::ResolveName(CCrmOwnerType::Company), 'fields' => array(array('id' => 'ID', 'name' => 'ID'), array('id' => 'TITLE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_TITLE')), array('id' => 'TYPE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMPANY_TYPE')), array('id' => 'ADDRESS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ACTUAL_ADDRESS')), array('id' => 'ADDRESS_LEGAL', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ADDRESS_LEGAL')), array('id' => 'BANKING_DETAILS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_BANKING_DETAILS')), array('id' => 'INDUSTRY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_INDUSTRY')), array('id' => 'EMPLOYEES', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_EMPLOYEES')), array('id' => 'CURRENCY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CURRENCY')), array('id' => 'REVENUE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_REVENUE')), array('id' => 'REVENUE_FORMATTED', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_REVENUE_FORMATTED')), array('id' => 'ASSIGNED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_FULL_NAME')), array('id' => 'ASSIGNED_BY_WORK_POSITION', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_ASSIGNED_BY_POST')), array('id' => 'CREATED_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_CREATED_BY_FULL_NAME')), array('id' => 'MODIFY_BY_FULL_NAME', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_MODIFY_BY_FULL_NAME')), array('id' => 'DATE_CREATE', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_CREATE')), array('id' => 'DATE_MODIFY', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_DATE_MODIFY')), array('id' => 'COMMENTS', 'name' => GetMessage('CRM_TEMPLATE_ADAPTER_COMMENTS'))));
}
return null;
}
示例14: TryUploadFile
public static function TryUploadFile(&$result, $options = array())
{
//Options initialization -->
$ownerTypeID = isset($options['OWNER_TYPE_ID']) ? intval($options['OWNER_TYPE_ID']) : CCrmOwnerType::Undefined;
if ($ownerTypeID !== CCrmOwnerType::Undefined && !CCrmOwnerType::IsDefined($ownerTypeID)) {
$ownerTypeID = CCrmOwnerType::Undefined;
}
$ownerID = isset($options['OWNER_ID']) ? max(intval($options['OWNER_ID']), 0) : 0;
$scope = isset($options['SCOPE']) ? strtoupper($options['SCOPE']) : '';
if (!in_array($scope, array('I', 'A', 'F'), true)) {
$scope = '';
}
$extensions = isset($options['EXTENSIONS']) && is_array($options['EXTENSIONS']) ? $options['EXTENSIONS'] : array();
$maxFileSize = isset($options['MAX_FILE_SIZE']) ? max(intval($options['MAX_FILE_SIZE']), 0) : 0;
//<-- Options initialization
if (!is_array($result)) {
$result = array();
}
$file = is_array($_FILES) && isset($_FILES['file']) ? $_FILES['file'] : null;
if (!is_array($file)) {
$result['ERROR_MESSAGE'] = 'No files';
return false;
}
$file['MODULE_ID'] = 'crm';
if ($scope === 'I') {
$error = CFile::CheckImageFile($file, $maxFileSize, 0, 0);
} elseif ($scope === 'F') {
$error = CFile::CheckFile($file, $maxFileSize, false, implode(',', $extensions));
} else {
$error = CFile::CheckFile($file, $maxFileSize, false, false);
}
$isValid = !(is_string($error) && $error !== '');
if (!$isValid) {
$result['ERROR_MESSAGE'] = $error;
return false;
}
$fileID = CFile::SaveFile($file, 'crm');
if (!is_int($fileID) || $fileID <= 0) {
$result['ERROR_MESSAGE'] = 'General error.';
return false;
}
if ($ownerTypeID != CCrmOwnerType::Undefined) {
$key = 'CRM_MBL_' . CCrmOwnerType::ResolveName($ownerTypeID) . '_' . $ownerID . '_FILES';
if (!isset($_SESSION[$key])) {
$_SESSION[$key] = array();
}
$_SESSION[$key][] = $fileID;
}
$result['FILE_ID'] = $fileID;
return true;
}
示例15: createMap
/**
* Create conversion map for destination entity type
* @static
* @param int $entityTypeID Destination Entity Type ID
* @return EntityConversionMap
*/
public static function createMap($entityTypeID)
{
if (!is_int($entityTypeID)) {
$entityTypeID = (int) $entityTypeID;
}
if (!\CCrmOwnerType::IsDefined($entityTypeID)) {
throw new Main\ArgumentOutOfRangeException('dstEntityTypeID', \CCrmOwnerType::FirstOwnerType, \CCrmOwnerType::LastOwnerType);
}
if ($entityTypeID !== \CCrmOwnerType::Contact && $entityTypeID !== \CCrmOwnerType::Company && $entityTypeID !== \CCrmOwnerType::Deal) {
$dstEntityTypeName = \CCrmOwnerType::ResolveName($entityTypeID);
throw new Main\NotSupportedException("Entity type: '{$dstEntityTypeName}' is not supported in current context");
}
$map = new EntityConversionMap(\CCrmOwnerType::Lead, $entityTypeID);
if ($entityTypeID === \CCrmOwnerType::Contact) {
//region Contact Map Static Field Bindings
$map->createItem('HONORIFIC');
$map->createItem('NAME');
$map->createItem('SECOND_NAME');
$map->createItem('LAST_NAME');
$map->createItem('BIRTHDATE');
$map->createItem('POST');
$map->createItem('COMMENTS');
$map->createItem('OPENED');
$map->createItem('SOURCE_ID');
$map->createItem('SOURCE_DESCRIPTION');
$map->createItem('ADDRESS');
$map->createItem('ADDRESS_2');
$map->createItem('ADDRESS_CITY');
$map->createItem('ADDRESS_POSTAL_CODE');
$map->createItem('ADDRESS_REGION');
$map->createItem('ADDRESS_PROVINCE');
$map->createItem('ADDRESS_COUNTRY');
$map->createItem('ADDRESS_COUNTRY_CODE');
$map->createItem('PHONE');
$map->createItem('EMAIL');
$map->createItem('WEB');
$map->createItem('IM');
$map->createItem('ASSIGNED_BY_ID');
$map->createItem('ORIGINATOR_ID');
$map->createItem('ORIGIN_ID');
//endregion
//region Contact Map User Field Bindings
$intersections = UserFieldSynchronizer::getIntersection(\CCrmOwnerType::Lead, \CCrmOwnerType::Contact);
foreach ($intersections as $intersection) {
$map->createItem($intersection['SRC_FIELD_NAME'], $intersection['DST_FIELD_NAME']);
}
//endregion
} elseif ($entityTypeID === \CCrmOwnerType::Company) {
//region Company Map Static Field Bindings
//$map->createItem('COMPANY_TITLE', 'TITLE', array('ALT_SRC_FIELD_IDS' => array('TITLE')));
$map->createItem('TITLE');
$map->createItem('COMMENTS');
$map->createItem('OPENED');
$map->createItem('ADDRESS');
$map->createItem('ADDRESS_2');
$map->createItem('ADDRESS_CITY');
$map->createItem('ADDRESS_POSTAL_CODE');
$map->createItem('ADDRESS_REGION');
$map->createItem('ADDRESS_PROVINCE');
$map->createItem('ADDRESS_COUNTRY');
$map->createItem('ADDRESS_COUNTRY_CODE');
$map->createItem('PHONE');
$map->createItem('EMAIL');
$map->createItem('WEB');
$map->createItem('IM');
$map->createItem('ASSIGNED_BY_ID');
$map->createItem('ORIGINATOR_ID');
$map->createItem('ORIGIN_ID');
//endregion
//region Company Map User Field Bindings
$intersections = UserFieldSynchronizer::getIntersection(\CCrmOwnerType::Lead, \CCrmOwnerType::Company);
foreach ($intersections as $intersection) {
$map->createItem($intersection['SRC_FIELD_NAME'], $intersection['DST_FIELD_NAME']);
}
//endregion
} elseif ($entityTypeID === \CCrmOwnerType::Deal) {
//region Deal Map Static Field Bindings
$map->createItem('TITLE');
$map->createItem('OPPORTUNITY');
$map->createItem('CURRENCY_ID');
$map->createItem('COMMENTS');
$map->createItem('OPENED');
$map->createItem('ADDRESS');
$map->createItem('ADDRESS_2');
$map->createItem('ADDRESS_CITY');
$map->createItem('ADDRESS_POSTAL_CODE');
$map->createItem('ADDRESS_REGION');
$map->createItem('ADDRESS_PROVINCE');
$map->createItem('ADDRESS_COUNTRY');
$map->createItem('ADDRESS_COUNTRY_CODE');
$map->createItem('PRODUCT_ROWS');
$map->createItem('ASSIGNED_BY_ID');
$map->createItem('ORIGINATOR_ID');
$map->createItem('ORIGIN_ID');
//.........这里部分代码省略.........