本文整理汇总了PHP中CCrmContact::GetUserFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::GetUserFields方法的具体用法?PHP CCrmContact::GetUserFields怎么用?PHP CCrmContact::GetUserFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmContact
的用法示例。
在下文中一共展示了CCrmContact::GetUserFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetDocument
public static function GetDocument($documentId)
{
$arDocumentID = self::GetDocumentInfo($documentId);
if (empty($arDocumentID)) {
throw new CBPArgumentNullException('documentId');
}
$arResult = null;
switch ($arDocumentID['TYPE']) {
case 'CONTACT':
$dbDocumentList = CCrmContact::GetListEx(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), false, false, array('*', 'UF_*'));
break;
case 'COMPANY':
$dbDocumentList = CCrmCompany::GetListEx(array(), array('ID' => $arDocumentID['ID'], 'CHECK_PERMISSIONS' => 'N'), false, false, array('*', 'UF_*'));
break;
case 'DEAL':
$dbDocumentList = CCrmDeal::GetListEx(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), false, false, array('*', 'UF_*'));
break;
case 'LEAD':
$dbDocumentList = CCrmLead::GetListEx(array(), array('ID' => $arDocumentID['ID'], "CHECK_PERMISSIONS" => "N"), false, false, array('*', 'UF_*'));
break;
}
if (($objDocument = $dbDocumentList->Fetch()) !== false) {
$assignedByID = isset($objDocument['ASSIGNED_BY_ID']) ? intval($objDocument['ASSIGNED_BY_ID']) : 0;
if ($assignedByID > 0) {
$dbUsers = CUser::GetList($sortBy = 'id', $sortOrder = 'asc', array('ID' => $assignedByID), array('SELECT' => array('EMAIL')));
$arUser = is_object($dbUsers) ? $dbUsers->Fetch() : null;
$objDocument['ASSIGNED_BY_EMAIL'] = is_array($arUser) ? $arUser['EMAIL'] : '';
}
$arUserField = array('CREATED_BY', 'CREATED_BY_ID', 'MODIFY_BY', 'MODIFY_BY_ID', 'ASSIGNED_BY', 'ASSIGNED_BY_ID');
foreach ($arUserField as $sField) {
if (isset($objDocument[$sField])) {
$objDocument[$sField] = 'user_' . $objDocument[$sField];
}
}
if (COption::GetOptionString('crm', 'bp_version', 2) == 2) {
$userFieldsList = null;
switch ($arDocumentID['TYPE']) {
case 'CONTACT':
$userFieldsList = CCrmContact::GetUserFields();
break;
case 'COMPANY':
$userFieldsList = CCrmCompany::GetUserFields();
break;
case 'DEAL':
$userFieldsList = CCrmDeal::GetUserFields();
break;
case 'LEAD':
$userFieldsList = CCrmLead::GetUserFields();
break;
}
if (is_array($userFieldsList)) {
foreach ($userFieldsList as $userFieldName => $userFieldParams) {
$fieldTypeID = isset($userFieldParams['USER_TYPE']) ? $userFieldParams['USER_TYPE']['USER_TYPE_ID'] : '';
$isFieldMultiple = isset($userFieldParams['MULTIPLE']) && $userFieldParams['MULTIPLE'] === 'Y';
$fieldSettings = isset($userFieldParams['SETTINGS']) ? $userFieldParams['SETTINGS'] : array();
if (isset($objDocument[$userFieldName])) {
$fieldValue = $objDocument[$userFieldName];
} elseif (isset($fieldSettings['DEFAULT_VALUE'])) {
$fieldValue = $fieldSettings['DEFAULT_VALUE'];
} else {
$objDocument[$userFieldName] = $objDocument[$userFieldName . '_PRINTABLE'] = '';
continue;
}
if ($fieldTypeID == 'employee') {
if (!$isFieldMultiple) {
$objDocument[$userFieldName] = 'user_' . $fieldValue;
} else {
$objDocument[$userFieldName] = array();
foreach ($fieldValue as $value) {
$objDocument[$userFieldName][] = 'user_' . $value;
}
}
} elseif ($fieldTypeID == 'crm') {
$defaultTypeName = '';
foreach ($fieldSettings as $typeName => $flag) {
if ($flag === 'Y') {
$defaultTypeName = $typeName;
break;
}
}
if (!$isFieldMultiple) {
$objDocument[$userFieldName . '_PRINTABLE'] = self::PrepareCrmUserTypeValueView($fieldValue, $defaultTypeName);
} else {
$views = array();
foreach ($fieldValue as $value) {
$views[] = self::PrepareCrmUserTypeValueView($value, $defaultTypeName);
}
$objDocument[$userFieldName . '_PRINTABLE'] = $views;
}
} elseif ($fieldTypeID == 'enumeration') {
self::ExternalizeEnumerationField($objDocument, $userFieldName);
} elseif ($fieldTypeID === 'boolean') {
//Convert UF boolean values (1/0) in to bizproc boolean values (Y/N) is display type checkbox
if (isset($fieldSettings['DISPLAY']) && $fieldSettings['DISPLAY'] === 'CHECKBOX') {
$objDocument[$userFieldName] = $fieldValue > 0 ? 'Y' : 'N';
}
$objDocument[$userFieldName . '_PRINTABLE'] = GetMessage($fieldValue > 0 ? 'MAIN_YES' : 'MAIN_NO');
}
}
}
//.........这里部分代码省略.........
示例2: getEntityUserFieldsInfo
protected function getEntityUserFieldsInfo()
{
return \CCrmContact::GetUserFields();
}