本文整理汇总了PHP中CCrmCompany::CheckReadPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmCompany::CheckReadPermission方法的具体用法?PHP CCrmCompany::CheckReadPermission怎么用?PHP CCrmCompany::CheckReadPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmCompany
的用法示例。
在下文中一共展示了CCrmCompany::CheckReadPermission方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$beginDate = isset($arResult['ELEMENT']['BEGINDATE']) ? $arResult['ELEMENT']['BEGINDATE'] : '';
$closeDate = isset($arResult['ELEMENT']['CLOSEDATE']) ? $arResult['ELEMENT']['CLOSEDATE'] : '';
$arResult['FIELDS']['tab_1'][] = array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_BEGINDATE'), 'params' => array('sale_order_marker' => 'Y'), 'type' => 'date_link', 'value' => $beginDate !== '' ? ConvertTimeStamp(MakeTimeStamp($beginDate), 'SHORT', SITE_ID) : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_CLOSEDATE'), 'type' => 'date_short', 'value' => $closeDate !== '' ? ConvertTimeStamp(MakeTimeStamp($closeDate), 'SHORT', SITE_ID) : '', 'params' => array('class' => 'bx-crm-dialog-input bx-crm-dialog-input-date'));
if (CCrmLead::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'LEAD_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LEAD_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'LEAD', 'INPUT_NAME' => 'LEAD_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['LEAD_ID']) ? $arResult['ELEMENT']['LEAD_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmDeal::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'DEAL_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_DEAL_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'DEAL', 'INPUT_NAME' => 'DEAL_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['DEAL_ID']) ? $arResult['ELEMENT']['DEAL_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_QUOTE_FIELD_OPENED'), 'type' => 'vertical_checkbox', 'params' => array(), 'value' => isset($arResult['ELEMENT']['OPENED']) ? $arResult['ELEMENT']['OPENED'] : true, 'title' => GetMessage('CRM_QUOTE_FIELD_OPENED_TITLE'));
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CLIENT_INFO'), 'type' => 'section');
if (CCrmContact::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CONTACT_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'NEW_INPUT_NAME' => CCrmContact::CheckCreatePermission() ? 'NEW_CONTACT_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['CONTACT_ID']) ? $arResult['ELEMENT']['CONTACT_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmCompany::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_COMPANY_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'COMPANY', 'INPUT_NAME' => 'COMPANY_ID', 'NEW_INPUT_NAME' => CCrmCompany::CheckCreatePermission() ? 'NEW_COMPANY_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['COMPANY_ID']) ? $arResult['ELEMENT']['COMPANY_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if ($bTaxMode) {
// CLIENT LOCATION
$sLocationHtml = '';
$locValue = isset($arResult['ELEMENT']['LOCATION_ID']) ? $arResult['ELEMENT']['LOCATION_ID'] : '';
ob_start();
CSaleLocation::proxySaleAjaxLocationsComponent(array('AJAX_CALL' => 'N', 'COUNTRY_INPUT_NAME' => 'LOC_COUNTRY', 'REGION_INPUT_NAME' => 'LOC_REGION', 'CITY_INPUT_NAME' => 'LOC_CITY', 'CITY_OUT_LOCATION' => 'Y', 'LOCATION_VALUE' => $locValue, 'ORDER_PROPS_ID' => 'QUOTE_' . $arResult['ELEMENT']['ID'], 'ONCITYCHANGE' => 'BX.onCustomEvent(\'CrmProductRowSetLocation\', [\'LOC_CITY\']);', 'SHOW_QUICK_CHOOSE' => 'N'), array("CODE" => $locValue, "ID" => "", "PROVIDE_LINK_BY" => "code", "JS_CALLBACK" => 'CrmProductRowSetLocation'), 'popup');
$sLocationHtml = ob_get_contents();
ob_end_clean();
$locationField = array('id' => 'LOCATION_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LOCATION_ID'), 'type' => 'custom', 'value' => $sLocationHtml . '<div>' . '<span class="bx-crm-edit-content-location-description">' . GetMessage('CRM_QUOTE_FIELD_LOCATION_ID_DESCRIPTION') . '</span>' . '</div>', 'required' => true);
$arResult['FIELDS']['tab_1'][] = $locationField;
$arResult['FORM_FIELDS_TO_ADD']['LOCATION_ID'] = $locationField;
unset($locationField);
}
示例2: GetShowUrl
public static function GetShowUrl($typeID, $ID, $bCheckPermissions = false)
{
$typeID = intval($typeID);
$ID = intval($ID);
if ($ID <= 0) {
return '';
}
switch ($typeID) {
case self::Lead:
if ($bCheckPermissions && !CCrmLead::CheckReadPermission($ID)) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_show'), array('lead_id' => $ID));
case self::Contact:
if ($bCheckPermissions && !CCrmContact::CheckReadPermission($ID)) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_show'), array('contact_id' => $ID));
case self::Company:
if ($bCheckPermissions && !CCrmCompany::CheckReadPermission($ID)) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_show'), array('company_id' => $ID));
case self::Deal:
if ($bCheckPermissions && !CCrmDeal::CheckReadPermission($ID)) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_show'), array('deal_id' => $ID));
case self::Activity:
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_activity_show'), array('activity_id' => $ID));
case self::Invoice:
if ($bCheckPermissions && !CCrmInvoice::CheckReadPermission($ID)) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_invoice_show'), array('invoice_id' => $ID));
case self::Quote:
if ($bCheckPermissions && !CCrmQuote::CheckReadPermission($ID)) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_show'), array('quote_id' => $ID));
default:
return '';
}
}
示例3: ShowError
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
global $APPLICATION;
use Bitrix\Crm\Integrity;
if (!CModule::IncludeModule('crm')) {
ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
return;
}
$userID = CCrmSecurityHelper::GetCurrentUserID();
$isAdminUser = CCrmPerms::IsAdmin($userID);
$userPermissions = CCrmPerms::GetUserPermissions($userID);
$enablePermissionCheck = !$isAdminUser;
if (!CCrmContact::CheckReadPermission(0, $userPermissions) && !CCrmCompany::CheckReadPermission(0, $userPermissions) && !CCrmLead::CheckReadPermission(0, $userPermissions)) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
$arResult['USER_ID'] = $userID;
$listID = isset($arParams['LIST_ID']) ? $arParams['LIST_ID'] : '';
if ($listID === '') {
$listID = uniqid('dedupe_');
}
$arResult['LIST_ID'] = $listID;
$arResult['ERRORS'] = array();
$arResult['MESSAGES'] = array();
$entityTypeID = isset($arParams['ENTITY_TYPE_ID']) ? intval($arParams['ENTITY_TYPE_ID']) : CCrmOwnerType::Undefined;
if ($entityTypeID === CCrmOwnerType::Undefined && isset($arParams['ENTITY_TYPE'])) {
$entityTypeID = CCrmOwnerType::ResolveID($arParams['ENTITY_TYPE']);
}
示例4: isset
}
if (!CModule::IncludeModule('crm') || !CCrmSecurityHelper::IsAuthorized() || !check_bitrix_sessid()) {
die;
}
$componentData = isset($_REQUEST['PARAMS']) && is_array($_REQUEST['PARAMS']) ? $_REQUEST['PARAMS'] : array();
$componentParams = isset($componentData['params']) && is_array($componentData['params']) ? $componentData['params'] : array();
//Security check
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
$filter = isset($componentParams['INTERNAL_FILTER']) && is_array($componentParams['INTERNAL_FILTER']) ? $componentParams['INTERNAL_FILTER'] : array();
$ID = isset($filter['ID']) ? $filter['ID'] : 0;
$companyID = isset($filter['COMPANY_ID']) ? $filter['COMPANY_ID'] : 0;
$isPermitted = false;
if ($ID > 0) {
$isPermitted = CCrmContact::CheckReadPermission($ID, $userPermissions);
} elseif ($companyID > 0) {
$isPermitted = CCrmCompany::CheckReadPermission($companyID, $userPermissions);
}
if (!$isPermitted) {
die;
}
//For custom reload with params
$ajaxLoaderParams = array('url' => '', 'method' => 'POST', 'dataType' => 'ajax', 'data' => array('PARAMS' => $componentData));
global $APPLICATION;
Header('Content-Type: text/html; charset=' . LANG_CHARSET);
$APPLICATION->ShowAjaxHead();
//Force AJAX mode
$componentParams['AJAX_MODE'] = 'Y';
$componentParams['AJAX_OPTION_JUMP'] = 'N';
$componentParams['AJAX_OPTION_HISTORY'] = 'N';
$componentParams['AJAX_LOADER'] = $ajaxLoaderParams;
//Enable sanitaizing
示例5: array
$arFields['FM']['PHONE'] = array('n0' => array('VALUE_TYPE' => 'WORK', 'VALUE' => $phone));
}
$CrmCompany = new CCrmCompany();
$ID = $CrmCompany->Add($arFields, true, array('DISABLE_USER_FIELD_CHECK' => true, 'REGISTER_SONET_EVENT' => true));
if (is_int($ID) && $ID > 0) {
$data['id'] = $ID;
$info = CCrmEntitySelectorHelper::PrepareEntityInfo('COMPANY', $ID);
echo CUtil::PhpToJSObject(array('DATA' => $data, 'INFO' => array('title' => $info['TITLE'], 'url' => $info['URL'])));
} else {
echo CUtil::PhpToJSObject(array('ERROR' => $CrmCompany->LAST_ERROR));
}
} elseif ($action === 'ENABLE_SONET_SUBSCRIPTION') {
$userID = CCrmSecurityHelper::GetCurrentUserID();
$entityTypeName = isset($_POST['ENTITY_TYPE']) ? strtoupper($_POST['ENTITY_TYPE']) : '';
$entityID = isset($_POST['ENTITY_ID']) ? intval($_POST['ENTITY_ID']) : 0;
if ($userID > 0 && $entityTypeName === CCrmOwnerType::CompanyName && $entityID > 0 && CCrmCompany::CheckReadPermission($entityID)) {
$isEnabled = CCrmSonetSubscription::IsRelationRegistered(CCrmOwnerType::Company, $entityID, CCrmSonetSubscriptionType::Observation, $userID);
$enable = isset($_POST['ENABLE']) && strtoupper($_POST['ENABLE']) === 'Y';
if ($isEnabled !== $enable) {
if ($enable) {
CCrmSonetSubscription::RegisterSubscription(CCrmOwnerType::Company, $entityID, CCrmSonetSubscriptionType::Observation, $userID);
} else {
CCrmSonetSubscription::UnRegisterSubscription(CCrmOwnerType::Company, $entityID, CCrmSonetSubscriptionType::Observation, $userID);
}
}
}
} elseif ($action === 'FIND_DUPLICATES') {
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
$params = isset($_POST['PARAMS']) && is_array($_POST['PARAMS']) ? $_POST['PARAMS'] : array();
$entityTypeName = isset($params['ENTITY_TYPE_NAME']) ? $params['ENTITY_TYPE_NAME'] : '';
if ($entityTypeName === '') {
示例6: array
}
$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
$bRead = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ');
$bExport = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'EXPORT');
$bImport = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'IMPORT');
$bAdd = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'ADD');
$bWrite = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'WRITE');
$bDelete = false;
$bDedupe = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'WRITE') && !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'DELETE');
} else {
$bExport = false;
$bImport = false;
$bDedupe = false;
$bRead = CCrmCompany::CheckReadPermission($arParams['ELEMENT_ID'], $CrmPerms);
$bAdd = CCrmCompany::CheckCreatePermission($CrmPerms);
$bWrite = CCrmCompany::CheckUpdatePermission($arParams['ELEMENT_ID'], $CrmPerms);
$bDelete = CCrmCompany::CheckDeletePermission($arParams['ELEMENT_ID'], $CrmPerms);
}
if ($arParams['TYPE'] === 'list') {
if ($bAdd) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('COMPANY_ADD'), 'TITLE' => GetMessage('COMPANY_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_EDIT'], array('company_id' => 0)), 'HIGHLIGHT' => true);
}
if ($bImport) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('COMPANY_IMPORT'), 'TITLE' => GetMessage('COMPANY_IMPORT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_IMPORT'], array()), 'ICON' => 'btn-import');
}
if ($bExport) {
$arResult['BUTTONS'][] = array('TITLE' => GetMessage('COMPANY_EXPORT_CSV_TITLE'), 'TEXT' => GetMessage('COMPANY_EXPORT_CSV'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'csv', 'ncc' => '1')), 'ICON' => 'btn-export');
$arResult['BUTTONS'][] = array('TITLE' => GetMessage('COMPANY_EXPORT_EXCEL_TITLE'), 'TEXT' => GetMessage('COMPANY_EXPORT_EXCEL'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'excel', 'ncc' => '1')), 'ICON' => 'btn-export');
}
示例7: findByPhoneNumber
public static function findByPhoneNumber($number, $params = array())
{
if (!is_string($number)) {
throw new \Bitrix\Main\ArgumentTypeException('number', 'string');
}
if ($number === '') {
throw new \Bitrix\Main\ArgumentException('Is empty', 'number');
}
if (!is_array($params)) {
$params = array();
}
$userID = isset($params['USER_ID']) ? intval($params['USER_ID']) : 0;
if ($userID <= 0) {
$userID = CCrmPerms::GetCurrentUserID();
}
$isAdmin = CCrmPerms::IsAdmin($userID);
$userPermissions = CCrmPerms::GetUserPermissions($userID);
$enableExtendedMode = isset($params['ENABLE_EXTENDED_MODE']) ? (bool) $params['ENABLE_EXTENDED_MODE'] : true;
$contactFormID = isset($params['CONTACT_FORM_ID']) ? intval($params['CONTACT_FORM_ID']) : '';
if ($contactFormID === '') {
$contactFormID = CCrmContact::DEFAULT_FORM_ID;
}
$dups = array();
$criterion = new \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion('PHONE', $number);
$entityTypes = array(CCrmOwnerType::Contact, CCrmOwnerType::Company, CCrmOwnerType::Lead);
foreach ($entityTypes as $entityType) {
$duplicate = $criterion->find($entityType, 1);
if ($duplicate !== null) {
$dups[] = $duplicate;
}
}
$entityByType = array();
foreach ($dups as &$dup) {
/** @var \Bitrix\Crm\Integrity\Duplicate $dup */
$entities = $dup->getEntities();
if (!(is_array($entities) && !empty($entities))) {
continue;
}
//Each entity type limited by 50 items
foreach ($entities as &$entity) {
/** @var \Bitrix\Crm\Integrity\DuplicateEntity $entity */
$entityTypeID = $entity->getEntityTypeID();
$entityID = $entity->getEntityID();
$fields = null;
if ($entityTypeID === CCrmOwnerType::Contact) {
$dbEntity = CCrmContact::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PHOTO', 'POST', 'COMPANY_ID', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
$entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
if (is_array($entityFields)) {
$formattedName = CCrmContact::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
$fields = array('ID' => intval($entityFields['ID']), 'FORMATTED_NAME' => $formattedName, 'PHOTO' => isset($entityFields['PHOTO']) ? intval($entityFields['PHOTO']) : 0, 'COMPANY_ID' => isset($entityFields['COMPANY_ID']) ? intval($entityFields['COMPANY_ID']) : 0, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmContact::CheckReadPermission($entityID, $userPermissions));
if ($fields['CAN_READ'] && $enableExtendedMode) {
$deals = array();
$dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=CONTACT_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
if (is_object($dbDeal)) {
while ($dealFields = $dbDeal->Fetch()) {
$dealID = intval($dealFields['ID']);
//$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
$dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
$deals[] = $dealFields;
}
}
$fields['DEALS'] =& $deals;
unset($deals);
}
}
} elseif ($entityTypeID === CCrmOwnerType::Company) {
$dbEntity = CCrmCompany::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'LOGO', 'ASSIGNED_BY_ID'));
$entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
if (is_array($entityFields)) {
$fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'LOGO' => isset($entityFields['LOGO']) ? intval($entityFields['LOGO']) : 0, 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmCompany::CheckReadPermission($entityID, $userPermissions));
if ($fields['CAN_READ'] && $enableExtendedMode) {
$deals = array();
$dbDeal = CCrmDeal::GetListEx(array('BEGINDATE' => 'ASC'), array('=COMPANY_ID' => $entityID, 'CLOSED' => 'N', 'CHECK_PERMISSIONS' => $isAdmin ? 'N' : 'Y'), false, array('nTopCount' => 2), array('ID', 'TITLE', 'STAGE_ID'), array('PERMS' => $userPermissions));
if (is_object($dbDeal)) {
while ($dealFields = $dbDeal->Fetch()) {
$dealID = intval($dealFields['ID']);
//$dealFields['CAN_READ'] = CCrmDeal::CheckReadPermission($dealID, $userPermissions);
$dealFields['SHOW_URL'] = CCrmOwnerType::GetShowUrl(CCrmOwnerType::Deal, $dealID);
$deals[] = $dealFields;
}
}
$fields['DEALS'] =& $deals;
unset($deals);
}
}
} elseif ($entityTypeID === CCrmOwnerType::Lead) {
$dbEntity = CCrmLead::GetListEx(array(), array('=ID' => $entityID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'TITLE', 'HONORIFIC', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'POST', 'COMPANY_TITLE', 'ASSIGNED_BY_ID'));
$entityFields = is_object($dbEntity) ? $dbEntity->Fetch() : null;
if (is_array($entityFields)) {
$formattedName = '';
if (!empty($entityFields['NAME']) || !empty($entityFields['SECOND_NAME']) || !empty($entityFields['LAST_NAME'])) {
$formattedName = CCrmLead::PrepareFormattedName(array('HONORIFIC' => isset($entityFields['HONORIFIC']) ? $entityFields['HONORIFIC'] : '', 'NAME' => isset($entityFields['NAME']) ? $entityFields['NAME'] : '', 'SECOND_NAME' => isset($entityFields['SECOND_NAME']) ? $entityFields['SECOND_NAME'] : '', 'LAST_NAME' => isset($entityFields['LAST_NAME']) ? $entityFields['LAST_NAME'] : ''));
}
$fields = array('ID' => intval($entityFields['ID']), 'TITLE' => isset($entityFields['TITLE']) ? $entityFields['TITLE'] : '', 'FORMATTED_NAME' => $formattedName, 'COMPANY_TITLE' => isset($entityFields['COMPANY_TITLE']) ? $entityFields['COMPANY_TITLE'] : '', 'POST' => isset($entityFields['POST']) ? $entityFields['POST'] : '', 'ASSIGNED_BY_ID' => isset($entityFields['ASSIGNED_BY_ID']) ? intval($entityFields['ASSIGNED_BY_ID']) : 0, 'CAN_READ' => CCrmLead::CheckReadPermission($entityID, $userPermissions));
}
}
if (!is_array($fields)) {
continue;
}
if ($fields['CAN_READ'] && $enableExtendedMode) {
//.........这里部分代码省略.........
示例8: processMethodRequest
public function processMethodRequest($name, $nameDetails, $arParams, $nav, $server)
{
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!CCrmLead::CheckReadPermission(0, $userPerms) && !CCrmContact::CheckReadPermission(0, $userPerms) && !CCrmCompany::CheckReadPermission(0, $userPerms)) {
throw new RestException('Access denied.');
}
if (strtoupper($name) === 'FINDBYCOMM') {
$type = strtoupper($this->resolveParam($arParams, 'type'));
if ($type !== 'EMAIL' && $type !== 'PHONE') {
if ($type === '') {
throw new RestException("Communication type is not defined.");
} else {
throw new RestException("Communication type '{$type}' is not supported in current context.");
}
}
$values = $this->resolveArrayParam($arParams, 'values');
if (!is_array($values) || count($values) === 0) {
throw new RestException("Communication values is not defined.");
}
$entityTypeID = CCrmOwnerType::ResolveID($this->resolveMultiPartParam($arParams, array('entity', 'type')));
if ($entityTypeID === CCrmOwnerType::Deal) {
throw new RestException("Deal is not supported in current context.");
}
$criterions = array();
$dups = array();
$qty = 0;
foreach ($values as $value) {
if (!is_string($value) || $value === '') {
continue;
}
$criterion = new \Bitrix\Crm\Integrity\DuplicateCommunicationCriterion($type, $value);
$isExists = false;
foreach ($criterions as $curCriterion) {
/** @var \Bitrix\Crm\Integrity\DuplicateCriterion $curCriterion */
if ($criterion->equals($curCriterion)) {
$isExists = true;
break;
}
}
if ($isExists) {
continue;
}
$criterions[] = $criterion;
$duplicate = $criterion->find($entityTypeID, 20);
if ($duplicate !== null) {
$dups[] = $duplicate;
}
$qty++;
if ($qty >= 20) {
break;
}
}
$entityByType = array();
foreach ($dups as $dup) {
/** @var \Bitrix\Crm\Integrity\Duplicate $dup */
$entities = $dup->getEntities();
if (!(is_array($entities) && !empty($entities))) {
continue;
}
//Each entity type limited by 50 items
foreach ($entities as $entity) {
/** @var \Bitrix\Crm\Integrity\DuplicateEntity $entity */
$entityTypeID = $entity->getEntityTypeID();
$entityTypeName = CCrmOwnerType::ResolveName($entityTypeID);
$entityID = $entity->getEntityID();
if (!isset($entityByType[$entityTypeName])) {
$entityByType[$entityTypeName] = array($entityID);
} elseif (!in_array($entityID, $entityByType[$entityTypeName], true)) {
$entityByType[$entityTypeName][] = $entityID;
}
}
}
return $entityByType;
}
throw new RestException('Method not found!', RestException::ERROR_METHOD_NOT_FOUND, CRestServer::STATUS_NOT_FOUND);
}
示例9: htmlspecialcharsbx
} else {
$liveFeedContainerID = $arResult['LIVE_FEED_CONTAINER_ID'] = $arResult['FORM_ID'] . '_live_feed_wrapper';
$liveFeedHtml = '<div id="' . htmlspecialcharsbx($liveFeedContainerID) . '"></div>';
$arResult['ENABLE_LIVE_FEED_LAZY_LOAD'] = true;
}
}
$arResult['FIELDS']['tab_live_feed'][] = array('id' => 'LIVE_FEED', 'name' => GetMessage('CRM_FIELD_LIVE_FEED'), 'colspan' => true, 'type' => 'custom', 'value' => $liveFeedHtml);
// <-- LIVE FEED SECTION
$arResult['FIELDS']['tab_activity'][] = array('id' => 'section_activity_grid', 'name' => GetMessage('CRM_SECTION_ACTIVITY_MAIN'), 'type' => 'section');
$arResult['FIELDS']['tab_activity'][] = array('id' => 'DEAL_ACTIVITY_GRID', 'name' => GetMessage('CRM_FIELD_DEAL_ACTIVITY'), 'colspan' => true, 'type' => 'crm_activity_list', 'componentData' => array('template' => 'grid', 'enableLazyLoad' => true, 'params' => array('BINDINGS' => array(array('TYPE_NAME' => 'DEAL', 'ID' => $arParams['ELEMENT_ID'])), 'PREFIX' => 'DEAL_ACTIONS_GRID', 'PERMISSION_TYPE' => 'WRITE', 'ENABLE_NAVIGATION' => 'Y', 'FORM_TYPE' => 'show', 'FORM_ID' => $arResult['FORM_ID'], 'TAB_ID' => 'tab_activity', 'USE_QUICK_FILTER' => 'Y')));
$formTabKey = $arResult['FORM_ID'] . '_active_tab';
$currentFormTabID = $_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET[$formTabKey]) ? $_GET[$formTabKey] : '';
if ($contactID > 0 && CCrmContact::CheckReadPermission($contactID, $currentUserPermissions)) {
$arResult['FIELDS']['tab_contact'][] = array('id' => 'DEAL_CONTACTS', 'name' => GetMessage('CRM_FIELD_DEAL_CONTACTS'), 'colspan' => true, 'type' => 'crm_contact_list', 'componentData' => array('template' => '', 'enableLazyLoad' => true, 'params' => array('CONTACT_COUNT' => '20', 'PATH_TO_CONTACT_SHOW' => $arParams['PATH_TO_CONTACT_SHOW'], 'PATH_TO_CONTACT_EDIT' => $arParams['PATH_TO_CONTACT_EDIT'], 'PATH_TO_DEAL_EDIT' => $arParams['PATH_TO_DEAL_EDIT'], 'INTERNAL_FILTER' => array('ID' => $contactID), 'GRID_ID_SUFFIX' => 'DEAL_SHOW', 'FORM_ID' => $arResult['FORM_ID'], 'TAB_ID' => 'tab_contact')));
}
if ($companyID > 0 && CCrmCompany::CheckReadPermission($companyID, $currentUserPermissions)) {
$arResult['FIELDS']['tab_company'][] = array('id' => 'DEAL_COMPANY', 'name' => GetMessage('CRM_FIELD_DEAL_COMPANY'), 'colspan' => true, 'type' => 'crm_company_list', 'componentData' => array('template' => '', 'enableLazyLoad' => true, 'params' => array('COMPANY_COUNT' => '20', 'PATH_TO_COMPANY_SHOW' => $arParams['PATH_TO_COMPANY_SHOW'], 'PATH_TO_COMPANY_EDIT' => $arParams['PATH_TO_COMPANY_EDIT'], 'PATH_TO_CONTACT_EDIT' => $arParams['PATH_TO_CONTACT_EDIT'], 'PATH_TO_DEAL_EDIT' => $arParams['PATH_TO_DEAL_EDIT'], 'INTERNAL_FILTER' => array('ID' => $companyID), 'GRID_ID_SUFFIX' => 'DEAL_SHOW', 'FORM_ID' => $arResult['FORM_ID'], 'TAB_ID' => 'tab_company', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'])));
}
if (!$CCrmDeal->cPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ')) {
$arResult['FIELDS']['tab_quote'][] = array('id' => 'DEAL_QUOTE', 'name' => GetMessage('CRM_FIELD_DEAL_QUOTE'), 'colspan' => true, 'type' => 'crm_quote_list', 'componentData' => array('template' => '', 'enableLazyLoad' => true, 'params' => array('QUOTE_COUNT' => '20', 'PATH_TO_QUOTE_SHOW' => $arResult['PATH_TO_QUOTE_SHOW'], 'PATH_TO_QUOTE_EDIT' => $arResult['PATH_TO_QUOTE_EDIT'], 'INTERNAL_FILTER' => array('DEAL_ID' => $arResult['ELEMENT']['ID']), 'INTERNAL_CONTEXT' => array('DEAL_ID' => $arResult['ELEMENT']['ID']), 'GRID_ID_SUFFIX' => 'DEAL_SHOW', 'FORM_ID' => $arResult['FORM_ID'], 'TAB_ID' => 'tab_quote', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'ENABLE_TOOLBAR' => true)));
}
if (!$CCrmDeal->cPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ')) {
$arResult['FIELDS']['tab_invoice'][] = array('id' => 'DEAL_INVOICE', 'name' => GetMessage('CRM_FIELD_DEAL_INVOICE'), 'colspan' => true, 'type' => 'crm_invoice_list', 'componentData' => array('template' => '', 'enableLazyLoad' => true, 'params' => array('INVOICE_COUNT' => '20', 'PATH_TO_COMPANY_SHOW' => $arParams['PATH_TO_COMPANY_SHOW'], 'PATH_TO_COMPANY_EDIT' => $arParams['PATH_TO_COMPANY_EDIT'], 'PATH_TO_CONTACT_EDIT' => $arParams['PATH_TO_CONTACT_EDIT'], 'PATH_TO_DEAL_EDIT' => $arParams['PATH_TO_DEAL_EDIT'], 'PATH_TO_INVOICE_EDIT' => $arParams['PATH_TO_INVOICE_EDIT'], 'PATH_TO_INVOICE_PAYMENT' => $arParams['PATH_TO_INVOICE_PAYMENT'], 'INTERNAL_FILTER' => array('UF_DEAL_ID' => $arResult['ELEMENT']['ID']), 'SUM_PAID_CURRENCY' => $currencyID, 'GRID_ID_SUFFIX' => 'DEAL_SHOW', 'FORM_ID' => $arResult['FORM_ID'], 'TAB_ID' => 'tab_invoice', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE'], 'ENABLE_TOOLBAR' => 'Y', 'INTERNAL_ADD_BTN_TITLE' => GetMessage('CRM_DEAL_ADD_INVOICE_TITLE'))));
}
if (IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc')) {
//HACK: main.interface.grid may override current tab
if ($_SERVER['REQUEST_METHOD'] === 'GET' && $currentFormTabID !== '') {
$_GET[$formTabKey] = $currentFormTabID;
}
$arResult['FIELDS']['tab_bizproc'][] = array('id' => 'section_bizproc', 'name' => GetMessage('CRM_SECTION_BIZPROC_MAIN'), 'type' => 'section');
$arResult['BIZPROC'] = 'Y';
示例10: checkEntityReadPermission
protected function checkEntityReadPermission($entityID, $userPermissions)
{
return \CCrmCompany::CheckReadPermission($entityID, $userPermissions);
}
示例11: __CrmMobileCompanyEditEndResonse
if ($successed) {
//$DB->Commit();
__CrmMobileCompanyEditEndResonse(array('DELETED_ENTITY_ID' => $ID));
} else {
//$DB->Rollback();
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_COMPANY_COULD_NOT_DELETE')));
}
} elseif ($action === 'GET_ENTITY') {
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
$typeName = isset($_REQUEST['ENTITY_TYPE_NAME']) ? $_REQUEST['ENTITY_TYPE_NAME'] : '';
if ($typeName !== 'COMPANY') {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_TYPE_NOT_SUPPORTED', array('#ENTITY_TYPE#' => $typeName))));
}
$ID = isset($_REQUEST['ENTITY_ID']) ? intval($_REQUEST['ENTITY_ID']) : 0;
if ($ID <= 0) {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_ID_NOT_FOUND')));
}
if (!CCrmCompany::CheckReadPermission($ID)) {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
}
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
$item = $dbRes ? $dbRes->GetNext() : null;
if (!is_array($item)) {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_COMPANY_NOT_FOUND', array('#ID#' => $ID))));
}
$formatParams = isset($_REQUEST['FORMAT_PARAMS']) ? $_REQUEST['FORMAT_PARAMS'] : array();
CCrmMobileHelper::PrepareCompanyItem($item, $formatParams);
__CrmMobileCompanyEditEndResonse(array('ENTITY' => CCrmMobileHelper::PrepareCompanyData($item)));
} else {
__CrmMobileCompanyEditEndResonse(array('ERROR' => 'Action is not supported in current context.'));
}
示例12: __IncludeLang
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
$data = isset($_REQUEST['SOURCE_DATA']) && is_array($_REQUEST['SOURCE_DATA']) ? $_REQUEST['SOURCE_DATA'] : array();
if (count($data) == 0) {
__CrmMobileInvoiceEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_DATA_NOT_FOUND')));
}
$enablePayerInfo = isset($data['ENABLE_PAYER_INFO']) ? strtoupper($data['ENABLE_PAYER_INFO']) === "Y" : false;
$enableProductRows = isset($data['ENABLE_PRODUCT_ROWS']) ? strtoupper($data['ENABLE_PRODUCT_ROWS']) === "Y" : false;
$productRows = $enableProductRows && isset($data['PRODUCT_ROWS']) && is_array($data['PRODUCT_ROWS']) ? $data['PRODUCT_ROWS'] : array();
$productRowQty = count($productRows);
//Save initial row's order
for ($i = 0; $i < $productRowQty; $i++) {
$productRows[$i]['IDX'] = $i;
}
$ID = isset($data['ID']) ? intval($data['ID']) : 0;
$companyID = isset($data['COMPANY_ID']) ? intval($data['COMPANY_ID']) : 0;
if ($companyID > 0 && !CCrmCompany::CheckReadPermission($companyID, $curUserPrems)) {
$companyID = 0;
}
$contactID = isset($data['CONTACT_ID']) ? intval($data['CONTACT_ID']) : 0;
if ($contactID > 0 && !CCrmContact::CheckReadPermission($contactID, $curUserPrems)) {
$contactID = 0;
}
$personTypeID = isset($data['PERSON_TYPE_ID']) ? intval($data['PERSON_TYPE_ID']) : 0;
$resolvedPersonTypeID = $companyID > 0 || $contactID > 0 ? CCrmInvoice::ResolvePersonTypeID($companyID, $contactID) : 0;
$paySystemID = isset($data['PAY_SYSTEM_ID']) ? intval($data['PAY_SYSTEM_ID']) : 0;
$paySystems = CCrmPaySystem::GetPaySystemsListItems($resolvedPersonTypeID);
$resolvedPaySystemID = 0;
if ($personTypeID === $resolvedPersonTypeID && $paySystemID > 0 && array_key_exists($paySystemID, $paySystems)) {
// Pay system does not changed
$resolvedPaySystemID = $paySystemID;
} elseif (!empty($paySystems)) {
示例13: array
// }
$arResult['FIELDS']['tab_1'][] = array('id' => 'DATE_BILL', 'name' => GetMessage('CRM_FIELD_DATE_BILL'), 'params' => array('sale_order_marker' => 'Y'), 'type' => 'date_link', 'value' => !empty($arResult['ELEMENT']['DATE_BILL']) ? ConvertTimeStamp(MakeTimeStamp($arResult['ELEMENT']['DATE_BILL']), 'SHORT', SITE_ID) : ConvertTimeStamp(time() + CTimeZone::GetOffset(), 'SHORT', SITE_ID));
$arResult['FIELDS']['tab_1'][] = array('id' => 'DATE_PAY_BEFORE', 'name' => GetMessage('CRM_FIELD_DATE_PAY_BEFORE'), 'params' => array('class' => 'bx-crm-dialog-input bx-crm-dialog-input-date', 'sale_order_marker' => 'Y'), 'type' => 'date_short', 'value' => !empty($arResult['ELEMENT']['DATE_PAY_BEFORE']) ? ConvertTimeStamp(MakeTimeStamp($arResult['ELEMENT']['DATE_PAY_BEFORE']), 'SHORT', SITE_ID) : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'RESPONSIBLE_ID', 'componentParams' => array('NAME' => 'crm_invoice_edit_resonsible', 'INPUT_NAME' => 'RESPONSIBLE_ID', 'SEARCH_INPUT_NAME' => 'RESPONSIBLE_NAME', 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE']), 'name' => GetMessage('CRM_FIELD_RESPONSIBLE_ID'), 'type' => 'intranet_user_search', 'value' => isset($arResult['ELEMENT']['RESPONSIBLE_ID']) ? $arResult['ELEMENT']['RESPONSIBLE_ID'] : $USER->GetID());
$arResult['FIELDS']['tab_1'][] = array('id' => 'CURRENCY_ID', 'name' => GetMessage('CRM_FIELD_CURRENCY_ID'), 'type' => 'label', 'params' => array('size' => 50), 'value' => htmlspecialcharsbx(isset($arResult['CURRENCY_LIST'][$currencyID]) ? $arResult['CURRENCY_LIST'][$currencyID] : $currencyID));
// DEAL LINK
if (CCrmDeal::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'UF_DEAL_ID', 'name' => GetMessage('CRM_FIELD_UF_DEAL_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'DEAL', 'INPUT_NAME' => 'UF_DEAL_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['UF_DEAL_ID']) ? $arResult['ELEMENT']['UF_DEAL_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
// QUOTE LINK
if (CCrmQuote::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'UF_QUOTE_ID', 'name' => GetMessage('CRM_FIELD_UF_QUOTE_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'QUOTE', 'INPUT_NAME' => 'UF_QUOTE_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['UF_QUOTE_ID']) ? $arResult['ELEMENT']['UF_QUOTE_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_invoice_payer', 'name' => GetMessage('CRM_SECTION_INVOICE_PAYER'), 'type' => 'section');
// CLIENT
if (CCrmContact::CheckReadPermission() && CCrmCompany::CheckReadPermission()) {
$clientValue = '';
if (intval($arResult['ELEMENT']['UF_COMPANY_ID']) > 0) {
$clientValue = 'CO_' . intval($arResult['ELEMENT']['UF_COMPANY_ID']);
} else {
if (intval($arResult['ELEMENT']['UF_CONTACT_ID']) > 0) {
$clientValue = 'C_' . intval($arResult['ELEMENT']['UF_CONTACT_ID']);
}
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'CLIENT_ID', 'name' => GetMessage('CRM_FIELD_CLIENT_ID'), 'type' => 'crm_client_selector', 'componentParams' => array('ENTITY_TYPE' => array('company', 'contact'), 'INPUT_NAME' => 'CLIENT_ID', 'NEW_INPUT_NAME' => 'CLIENT_ID_NEW', 'INPUT_VALUE' => $clientValue, 'FORM_ID' => $arResult['FORM_ID'], 'NAME_TEMPLATE' => $arParams['NAME_TEMPLATE']), 'required' => true);
unset($clientValue);
$arResult['CLIENT_CREATE_ENTITIES_CONTAINER_ID'] = "{$arResult['FORM_ID']}_CREATE_ENTITIES_CLIENT_ID";
}
// CONTACT PERSON
if (CCrmContact::CheckReadPermission()) {
$contactPersonValue = '';