本文整理汇总了PHP中CCrmCompany::CheckUpdatePermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmCompany::CheckUpdatePermission方法的具体用法?PHP CCrmCompany::CheckUpdatePermission怎么用?PHP CCrmCompany::CheckUpdatePermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmCompany
的用法示例。
在下文中一共展示了CCrmCompany::CheckUpdatePermission方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadBulk
private static function loadBulk($entityTypeID, array &$entityIDs, array &$itemMap, array $options = null)
{
/** @var DuplicateEntityRanking[] $itemMap */
if ($entityTypeID !== \CCrmOwnerType::Contact && $entityTypeID !== \CCrmOwnerType::Company && $entityTypeID !== \CCrmOwnerType::Lead) {
return;
}
if (!is_array($options)) {
$options = array();
}
$checkPermissions = isset($options['CHECK_PERMISSIONS']) ? (bool) $options['CHECK_PERMISSIONS'] : false;
$userID = isset($options['USER_ID']) ? (int) $options['USER_ID'] : 0;
$permissions = $checkPermissions ? \CCrmPerms::GetUserPermissions($userID) : null;
$limit = isset($options['LIMIT']) ? (int) $options['LIMIT'] : 3000;
if ($limit <= 0) {
$limit = 3000;
}
$length = count($entityIDs);
if ($length === 0) {
return;
}
while ($length > 0) {
if ($length <= $limit) {
$ids = $entityIDs;
unset($entityIDs);
$entityIDs = array();
} else {
$ids = array_splice($entityIDs, 0, $limit);
}
$length = count($entityIDs);
if (empty($ids)) {
continue;
}
if ($entityTypeID === \CCrmOwnerType::Lead) {
$dbResult = Entity\DuplicateEntityStatisticsTable::getList(array('select' => array('ENTITY_ID', 'RANKING_DATA'), 'filter' => array('ENTITY_TYPE_ID' => \CCrmOwnerType::Lead, 'ENTITY_ID' => $ids)));
while ($fields = $dbResult->fetch()) {
$entityID = intval($fields['ENTITY_ID']);
$key = "{$entityTypeID}_{$entityID}";
if (!isset($itemMap[$key])) {
continue;
}
if (isset($fields['RANKING_DATA']) && $fields['RANKING_DATA'] !== '') {
$data = unserialize($fields['RANKING_DATA']);
/** @var DuplicateEntityRanking $ranking */
$ranking = $itemMap[$key];
$ranking->lastChanged = isset($data['LAST_CHANGED']) ? $data['LAST_CHANGED'] : 0;
$ranking->completeness = isset($data['COMPLETENESS']) ? $data['COMPLETENESS'] : 0;
if ($checkPermissions) {
$ranking->editable = \CCrmLead::CheckUpdatePermission($entityID, $permissions);
$ranking->deleteable = \CCrmLead::CheckDeletePermission($entityID, $permissions);
}
}
}
} else {
$query = new Main\Entity\Query(Entity\DuplicateEntityStatisticsTable::getEntity());
$query->addSelect('ENTITY_ID');
$query->addSelect('RANKING_DATA');
$query->addFilter('ENTITY_ID', $ids);
$query->addFilter('ENTITY_TYPE_ID', $entityTypeID);
if ($entityTypeID === \CCrmOwnerType::Contact) {
$subQuery = new Main\Entity\Query(DealTable::getEntity());
$subQuery->addSelect('CONTACT_ID');
$subQuery->addFilter('CONTACT_ID', $ids);
$subQuery->addSelect('QTY');
$subQuery->registerRuntimeField('', new Main\Entity\ExpressionField('QTY', 'COUNT(*)'));
$referenceField = new Main\Entity\ReferenceField('D', Main\Entity\Base::getInstanceByQuery($subQuery), array('=this.ENTITY_ID' => 'ref.CONTACT_ID'), array('join_type' => 'LEFT'));
} else {
$subQuery = new Main\Entity\Query(DealTable::getEntity());
$subQuery->addSelect('COMPANY_ID');
$subQuery->addFilter('COMPANY_ID', $ids);
$subQuery->addSelect('QTY');
$subQuery->registerRuntimeField('', new Main\Entity\ExpressionField('QTY', 'COUNT(*)'));
$referenceField = new Main\Entity\ReferenceField('D', Main\Entity\Base::getInstanceByQuery($subQuery), array('=this.ENTITY_ID' => 'ref.COMPANY_ID'), array('join_type' => 'LEFT'));
}
$query->registerRuntimeField('', $referenceField);
$query->addSelect('D.QTY', 'QTY');
$dbResult = $query->exec();
while ($fields = $dbResult->fetch()) {
$entityID = intval($fields['ENTITY_ID']);
$key = "{$entityTypeID}_{$entityID}";
if (!isset($itemMap[$key])) {
continue;
}
$itemMap[$key]->referenceCount = isset($fields['QTY']) ? intval($fields['QTY']) : 0;
if (isset($fields['RANKING_DATA']) && $fields['RANKING_DATA'] !== '') {
$data = unserialize($fields['RANKING_DATA']);
/** @var DuplicateEntityRanking $ranking */
$ranking = $itemMap[$key];
$ranking->lastChanged = isset($data['LAST_CHANGED']) ? $data['LAST_CHANGED'] : 0;
$ranking->completeness = isset($data['COMPLETENESS']) ? $data['COMPLETENESS'] : 0;
if ($checkPermissions) {
if ($entityTypeID === \CCrmOwnerType::Contact) {
$ranking->editable = \CCrmContact::CheckUpdatePermission($entityID, $permissions);
$ranking->deleteable = \CCrmContact::CheckDeletePermission($entityID, $permissions);
} else {
$ranking->editable = \CCrmCompany::CheckUpdatePermission($entityID, $permissions);
$ranking->deleteable = \CCrmCompany::CheckDeletePermission($entityID, $permissions);
}
}
}
}
//.........这里部分代码省略.........
示例2: CCrmCompany
return;
}
// 'Fileman' module always installed
CModule::IncludeModule('fileman');
$CCrmCompany = new CCrmCompany();
if ($CCrmCompany->cPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE)) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
use Bitrix\Crm\Format\CompanyAddressFormatter;
use Bitrix\Crm\Format\AddressSeparator;
use Bitrix\Crm\EntityAddress;
CUtil::InitJSCore(array('ajax', 'tooltip'));
$arResult['EDITABLE_FIELDS'] = array();
$arResult['ELEMENT_ID'] = $arParams['ELEMENT_ID'] = isset($arParams['ELEMENT_ID']) ? intval($arParams['ELEMENT_ID']) : 0;
$arResult['CAN_EDIT'] = CCrmCompany::CheckUpdatePermission($arResult['ELEMENT_ID'], $CCrmCompany->cPerms);
$arParams['PATH_TO_COMPANY_LIST'] = CrmCheckPath('PATH_TO_COMPANY_LIST', $arParams['PATH_TO_COMPANY_LIST'], $APPLICATION->GetCurPage());
$arResult['PATH_TO_COMPANY_SHOW'] = $arParams['PATH_TO_COMPANY_SHOW'] = CrmCheckPath('PATH_TO_COMPANY_SHOW', $arParams['PATH_TO_COMPANY_SHOW'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&show');
$arParams['PATH_TO_COMPANY_EDIT'] = CrmCheckPath('PATH_TO_COMPANY_EDIT', $arParams['PATH_TO_COMPANY_EDIT'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&edit');
$arParams['PATH_TO_LEAD_SHOW'] = CrmCheckPath('PATH_TO_LEAD_SHOW', $arParams['PATH_TO_LEAD_SHOW'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&show');
$arParams['PATH_TO_LEAD_EDIT'] = CrmCheckPath('PATH_TO_LEAD_EDIT', $arParams['PATH_TO_LEAD_EDIT'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&edit');
$arParams['PATH_TO_LEAD_CONVERT'] = CrmCheckPath('PATH_TO_LEAD_CONVERT', $arParams['PATH_TO_LEAD_CONVERT'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&convert');
$arParams['PATH_TO_CONTACT_SHOW'] = CrmCheckPath('PATH_TO_CONTACT_SHOW', $arParams['PATH_TO_CONTACT_SHOW'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&show');
$arParams['PATH_TO_CONTACT_EDIT'] = CrmCheckPath('PATH_TO_CONTACT_EDIT', $arParams['PATH_TO_CONTACT_EDIT'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&edit');
$arParams['PATH_TO_DEAL_SHOW'] = CrmCheckPath('PATH_TO_DEAL_SHOW', $arParams['PATH_TO_DEAL_SHOW'], $APPLICATION->GetCurPage() . '?deal_id=#deal_id#&show');
$arParams['PATH_TO_DEAL_EDIT'] = CrmCheckPath('PATH_TO_DEAL_EDIT', $arParams['PATH_TO_DEAL_EDIT'], $APPLICATION->GetCurPage() . '?deal_id=#deal_id#&edit');
$arParams['PATH_TO_USER_PROFILE'] = CrmCheckPath('PATH_TO_USER_PROFILE', $arParams['PATH_TO_USER_PROFILE'], '/company/personal/user/#user_id#/');
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
global $USER_FIELD_MANAGER;
$CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, CCrmCompany::$sUFEntityID);
$bEdit = false;
示例3: while
// page count
$arResult['PAGER_PARAM'] = "PAGEN_{$arResult['PAGE_NAVNUM']}";
$arResult['PAGE_NEXT_NUMBER'] = $arResult['PAGE_NUMBER'] + 1;
while ($item = $dbRes->Fetch()) {
$itemID = intval($item['ID']);
$ownerID = intval($item['OWNER_ID']);
$ownerTypeID = intval($item['OWNER_TYPE_ID']);
CCrmMobileHelper::PrepareActivityItem($item, $arParams, array('ENABLE_COMMUNICATIONS' => false));
$arResult['ITEMS'][] =& $item;
unset($item);
}
if ($arResult['PAGE_NEXT_NUMBER'] > $arResult['PAGE_NAVCOUNT']) {
$arResult['NEXT_PAGE_URL'] = '';
} else {
$arResult['NEXT_PAGE_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&PAGING=Y&FORMAT=json&' . $arResult['PAGER_PARAM'] . '=' . $arResult['PAGE_NEXT_NUMBER'], array('AJAX_CALL', 'PAGING', 'FORMAT', 'SEARCH', $arResult['PAGER_PARAM']));
}
$arResult['SEARCH_PAGE_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&SEARCH=Y&FORMAT=json&apply_filter=Y&save=Y', array('AJAX_CALL', 'SEARCH', 'FORMAT', 'save', 'apply_filter', 'clear_filter'));
$arResult['SERVICE_URL'] = SITE_DIR . 'bitrix/components/bitrix/mobile.crm.activity.list/ajax.php?siteID=' . SITE_ID . '&' . bitrix_sessid_get();
$arResult['IS_FILTERED'] = !empty($filter);
$arResult['CREATE_CALL_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Call)) : '';
$arResult['CREATE_MEETING_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Meeting)) : '';
$arResult['CREATE_EMAIL_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Email)) : '';
$arResult['RELOAD_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&FORMAT=json', array('AJAX_CALL', 'SEARCH', 'FORMAT', 'save', 'apply_filter', 'clear_filter'));
//Require any update permission
$arResult['PERMISSIONS'] = array('CREATE' => CCrmLead::CheckUpdatePermission(0, $userPerms) || CCrmCompany::CheckUpdatePermission(0, $userPerms) || CCrmContact::CheckUpdatePermission(0, $userPerms) || CCrmDeal::CheckUpdatePermission(0, $userPerms));
$format = isset($_REQUEST['FORMAT']) ? strtolower($_REQUEST['FORMAT']) : '';
// Only JSON format is supported
if ($format !== '' && $format !== 'json') {
$format = '';
}
$this->IncludeComponentTemplate($format);
示例4: __CrmMobileFileEndResonse
die;
}
}
if (CModule::IncludeModule('compression')) {
CCompress::Disable2048Spaces();
}
CUtil::JSPostUnescape();
if (!CModule::IncludeModule('crm')) {
__CrmMobileFileEndResonse(array('error' => 'Could not include "crm" module.'));
}
if (!(check_bitrix_sessid() && CCrmSecurityHelper::IsAuthorized())) {
__CrmMobileFileEndResonse(array('error' => 'Access denied.'));
}
global $APPLICATION;
if ($_SERVER['REQUEST_METHOD'] === 'POST' && is_array($_FILES) && !empty($_FILES)) {
$ID = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$hasPermission = $ID > 0 ? CCrmCompany::CheckUpdatePermission($ID) : CCrmCompany::CheckCreatePermission();
if (!$hasPermission) {
__CrmMobileFileEndResonse(array('error' => 'Access denied.'));
} else {
$result = array();
if (!CCrmMobileHelper::TryUploadFile($result, array('OWNER_TYPE_ID' => CCrmOwnerType::Company, 'OWNER_ID' => $ID, 'SCOPE' => 'I', 'MAX_FILE_SIZE' => 5242880))) {
__CrmMobileFileEndResonse(array('error' => $result['ERROR_MESSAGE']));
} else {
$fileID = $result['FILE_ID'];
$fileInfo = CFile::ResizeImageGet($fileID, array('width' => 55, 'height' => 55), BX_RESIZE_IMAGE_EXACT, false, false, true);
__CrmMobileFileEndResonse(array('fileId' => $fileID, 'showUrl' => is_array($fileInfo) && isset($fileInfo['src']) ? $fileInfo['src'] : ''));
}
}
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
示例5: GetEditUrl
public static function GetEditUrl($typeID, $ID, $bCheckPermissions = false)
{
$typeID = intval($typeID);
$ID = intval($ID);
if ($ID <= 0) {
$ID = 0;
}
switch ($typeID) {
case self::Lead:
if ($bCheckPermissions && !($ID > 0 ? CCrmLead::CheckUpdatePermission($ID) : CCrmLead::CheckCreatePermission())) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_lead_edit'), array('lead_id' => $ID));
case self::Contact:
if ($bCheckPermissions && !($ID > 0 ? CCrmContact::CheckUpdatePermission($ID) : CCrmContact::CheckCreatePermission())) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_contact_edit'), array('contact_id' => $ID));
case self::Company:
if ($bCheckPermissions && !($ID > 0 ? CCrmCompany::CheckUpdatePermission($ID) : CCrmCompany::CheckCreatePermission())) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_company_edit'), array('company_id' => $ID));
case self::Deal:
if ($bCheckPermissions && !($ID > 0 ? CCrmDeal::CheckUpdatePermission($ID) : CCrmDeal::CheckCreatePermission())) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_deal_edit'), array('deal_id' => $ID));
case self::Invoice:
if ($bCheckPermissions && !($ID > 0 ? CCrmInvoice::CheckUpdatePermission($ID) : CCrmInvoice::CheckCreatePermission())) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_invoice_edit'), array('invoice_id' => $ID));
case self::Quote:
if ($bCheckPermissions && !($ID > 0 ? CCrmQuote::CheckUpdatePermission($ID) : CCrmQuote::CheckCreatePermission())) {
return '';
}
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_quote_edit'), array('quote_id' => $ID));
case self::Activity:
return CComponentEngine::MakePathFromTemplate(COption::GetOptionString('crm', 'path_to_activity_edit'), array('activity_id' => $ID));
default:
return '';
}
}
示例6: isset
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$entityID = $arParams['ENTITY_ID'] = isset($arParams['ENTITY_ID']) ? intval($arParams['ENTITY_ID']) : 0;
if ($entityID <= 0 && isset($_GET['company_id'])) {
$entityID = $arParams['ENTITY_ID'] = intval($_GET['company_id']);
}
$arResult['ENTITY_ID'] = $entityID;
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']);
$arResult['USER_ID'] = intval(CCrmSecurityHelper::GetCurrentUserID());
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
$arParams['UID'] = 'mobile_crm_company_view';
}
$arResult['UID'] = $arParams['UID'];
$serviceURLTemplate = $arParams["SERVICE_URL_TEMPLATE"] ? $arParams["SERVICE_URL_TEMPLATE"] : '#SITE_DIR#bitrix/components/bitrix/mobile.crm.company.edit/ajax.php?site_id=#SITE#&sessid=#SID#';
$arResult['SERVICE_URL'] = CComponentEngine::makePathFromTemplate($serviceURLTemplate, array('SID' => bitrix_sessid()));
$arResult['PERMISSIONS'] = array('EDIT' => CCrmCompany::CheckUpdatePermission($entityID, $userPerms), 'DELETE' => CCrmCompany::CheckDeletePermission($entityID, $userPerms));
$dbFields = CCrmCompany::GetListEx(array(), array('ID' => $entityID));
$arFields = $dbFields->GetNext();
if (!$arFields) {
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']);
示例7: __CrmCompanyShowEndJsonResonse
__CrmCompanyShowEndJsonResonse(array('DATA' => array('TITLE' => isset($arRes['TITLE']) ? $arRes['TITLE'] : '', 'LEGEND' => '', 'IMAGE_URL' => $imageUrl, 'SHOW_URL' => CCrmOwnerType::GetShowUrl(CCrmOwnerType::Company, $entityID, false))));
}
}
$type = isset($_POST['OWNER_TYPE']) ? strtoupper($_POST['OWNER_TYPE']) : '';
if ($type !== 'CO') {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'OWNER_TYPE IS NOT SUPPORTED!'));
}
if (!CCrmCompany::CheckUpdatePermission(0)) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'PERMISSION DENIED!'));
}
if ($mode === 'UPDATE') {
$ID = isset($_POST['OWNER_ID']) ? $_POST['OWNER_ID'] : 0;
if ($ID <= 0) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'ID IS INVALID OR NOT DEFINED!'));
}
if (!CCrmCompany::CheckUpdatePermission($ID)) {
__CrmCompanyShowEndJsonResonse(array('ERROR' => 'PERMISSION DENIED!'));
}
$fieldNames = array();
$hasUserFields = false;
if (isset($_POST['FIELD_NAME'])) {
if (is_array($_POST['FIELD_NAME'])) {
$fieldNames = $_POST['FIELD_NAME'];
foreach ($fieldNames as $fieldName) {
if (strncmp($fieldName, 'UF_', 3) === 0) {
$hasUserFields = true;
break;
}
}
} else {
$fieldNames[] = $_POST['FIELD_NAME'];
示例8: ShowError
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule('crm')) {
ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
return;
}
$entityID = $arParams['ENTITY_ID'] = isset($arParams['ENTITY_ID']) ? intval($arParams['ENTITY_ID']) : 0;
if ($entityID <= 0 && isset($_GET['company_id'])) {
$entityID = $arParams['ENTITY_ID'] = intval($_GET['company_id']);
}
$arResult['ENTITY_ID'] = $entityID;
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!($entityID > 0 ? CCrmCompany::CheckUpdatePermission($entityID, $userPerms) : CCrmCompany::CheckCreatePermission($userPerms))) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
global $APPLICATION;
$arParams['COMPANY_SHOW_URL_TEMPLATE'] = isset($arParams['COMPANY_SHOW_URL_TEMPLATE']) ? $arParams['COMPANY_SHOW_URL_TEMPLATE'] : '';
$arParams['COMPANY_EDIT_URL_TEMPLATE'] = isset($arParams['COMPANY_EDIT_URL_TEMPLATE']) ? $arParams['COMPANY_EDIT_URL_TEMPLATE'] : '';
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$arParams['STATUS_SELECTOR_URL_TEMPLATE'] = isset($arParams['STATUS_SELECTOR_URL_TEMPLATE']) ? $arParams['STATUS_SELECTOR_URL_TEMPLATE'] : '';
$arParams['CONTACT_SELECTOR_URL_TEMPLATE'] = isset($arParams['CONTACT_SELECTOR_URL_TEMPLATE']) ? $arParams['CONTACT_SELECTOR_URL_TEMPLATE'] : '';
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']);
$uid = isset($arParams['UID']) ? $arParams['UID'] : '';
if ($uid === '') {
$uid = 'mobile_crm_company_edit';
}
$arResult['UID'] = $arParams['UID'] = $uid;
示例9: elseif
}
} 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 === '') {
__CrmCompanyEditEndResonse(array('ERROR' => 'Entity type is not specified.'));
}
$entityTypeID = CCrmOwnerType::ResolveID($entityTypeName);
if ($entityTypeID === CCrmOwnerType::Undefined) {
__CrmCompanyEditEndResonse(array('ERROR' => 'Undefined entity type is specified.'));
}
if ($entityTypeID !== CCrmOwnerType::Company) {
__CrmCompanyEditEndResonse(array('ERROR' => "The '{$entityTypeName}' type is not supported in current context."));
}
if (!(CCrmCompany::CheckCreatePermission($userPermissions) || CCrmCompany::CheckUpdatePermission(0, $userPermissions))) {
__CrmCompanyEditEndResonse(array('ERROR' => 'Access denied.'));
}
$userProfileUrlTemplate = COption::GetOptionString("main", "TOOLTIP_PATH_TO_USER", "", SITE_ID);
$checker = new \Bitrix\Crm\Integrity\CompanyDuplicateChecker();
$checker->setStrictComparison(false);
$groupResults = array();
$groupData = isset($params['GROUPS']) && is_array($params['GROUPS']) ? $params['GROUPS'] : array();
foreach ($groupData as &$group) {
$fields = array();
$fieldNames = array();
if (isset($group['TITLE'])) {
$fieldNames[] = 'TITLE';
$fields['TITLE'] = $group['TITLE'];
}
$phones = isset($group['PHONES']) ? $group['PHONES'] : (isset($group['PHONE']) ? $group['PHONE'] : null);
示例10: array
$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');
}
if ($bDedupe) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('COMPANY_DEDUPE'), 'TITLE' => GetMessage('COMPANY_DEDUPE_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_DEDUPE'], array()), 'ICON' => 'btn-dedupe');
示例11: innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
{
if (!CCrmCompany::CheckUpdatePermission($ID)) {
$errors[] = 'Access denied.';
return false;
}
if (isset($fields['COMMENTS'])) {
$fields['COMMENTS'] = $this->sanitizeHtml($fields['COMMENTS']);
}
$entity = self::getEntity();
$options = array();
if (is_array($params) && isset($params['REGISTER_SONET_EVENT'])) {
$options['REGISTER_SONET_EVENT'] = strtoupper($params['REGISTER_SONET_EVENT']) === 'Y';
}
$result = $entity->Update($ID, $fields, true, true, $options);
if ($result !== true) {
$errors[] = $entity->LAST_ERROR;
} elseif (self::isBizProcEnabled()) {
CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Company, $ID, CCrmBizProcEventType::Edit, $errors);
}
return $result;
}
示例12: checkEntityUpdatePermission
protected function checkEntityUpdatePermission($entityID, $userPermissions)
{
return \CCrmCompany::CheckUpdatePermission($entityID, $userPermissions);
}
示例13: IncludeModuleLangFile
<?php
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
global $APPLICATION;
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/stream/index.php");
$APPLICATION->SetTitle(GetMessage("CRM_TITLE"));
$APPLICATION->SetPageProperty("BodyClass", " page-one-column");
if (CModule::IncludeModule("crm") && CCrmPerms::IsAccessEnabled()) {
$currentUserPerms = CCrmPerms::GetCurrentUserPermissions();
$canEdit = CCrmLead::CheckUpdatePermission(0, $currentUserPerms) || CCrmContact::CheckUpdatePermission(0, $currentUserPerms) || CCrmCompany::CheckUpdatePermission(0, $currentUserPerms) || CCrmDeal::CheckUpdatePermission(0, $currentUserPerms);
$APPLICATION->IncludeComponent("bitrix:crm.control_panel", "", array("ID" => "STREAM", "ACTIVE_ITEM_ID" => "STREAM", "PATH_TO_COMPANY_LIST" => "/crm/company/", "PATH_TO_COMPANY_EDIT" => "/crm/company/edit/#company_id#/", "PATH_TO_CONTACT_LIST" => "/crm/contact/", "PATH_TO_CONTACT_EDIT" => "/crm/contact/edit/#contact_id#/", "PATH_TO_DEAL_LIST" => "/crm/deal/", "PATH_TO_DEAL_EDIT" => "/crm/deal/edit/#deal_id#/", "PATH_TO_QUOTE_LIST" => "/crm/quote/", "PATH_TO_QUOTE_EDIT" => "/crm/quote/edit/#quote_id#/", "PATH_TO_INVOICE_LIST" => "/crm/invoice/", "PATH_TO_INVOICE_EDIT" => "/crm/invoice/edit/#invoice_id#/", "PATH_TO_LEAD_LIST" => "/crm/lead/", "PATH_TO_LEAD_EDIT" => "/crm/lead/edit/#lead_id#/", "PATH_TO_REPORT_LIST" => "/crm/reports/report/", "PATH_TO_DEAL_FUNNEL" => "/crm/reports/", "PATH_TO_EVENT_LIST" => "/crm/events/", "PATH_TO_PRODUCT_LIST" => "/crm/product/", "PATH_TO_SETTINGS" => "/crm/configs/", "PATH_TO_SEARCH_PAGE" => "/search/index.php?where=crm"));
// --> IMPORT RESPONSIBILITY SUBSCRIPTIONS
$currentUserID = CCrmSecurityHelper::GetCurrentUserID();
if ($currentUserID > 0) {
CCrmSonetSubscription::EnsureAllResponsibilityImported($currentUserID);
}
// <-- IMPORT RESPONSIBILITY SUBSCRIPTIONS
$APPLICATION->IncludeComponent("bitrix:crm.entity.livefeed", "", array("DATE_TIME_FORMAT" => "d.m.Y H:i:s", "CAN_EDIT" => $canEdit, "FORM_ID" => "", "PATH_TO_USER_PROFILE" => "/company/personal/user/#user_id#/", "PATH_TO_GROUP" => "/workgroups/group/#group_id#/", "PATH_TO_CONPANY_DEPARTMENT" => "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"), null, array("HIDE_ICONS" => "Y"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";
示例14: isset
}
$curUserPrems = CCrmPerms::GetCurrentUserPermissions();
$action = isset($_REQUEST['ACTION']) ? $_REQUEST['ACTION'] : '';
if ($action === 'SAVE_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))));
}
$data = isset($_REQUEST['ENTITY_DATA']) && is_array($_REQUEST['ENTITY_DATA']) ? $_REQUEST['ENTITY_DATA'] : array();
if (count($data) == 0) {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_DATA_NOT_FOUND')));
}
$ID = isset($data['ID']) ? intval($data['ID']) : 0;
$isNew = $ID <= 0;
$hasPermission = $isNew ? CCrmCompany::CheckCreatePermission() : CCrmCompany::CheckUpdatePermission($ID);
if (!$hasPermission) {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
}
$currentItem = null;
if (!$isNew) {
$dbRes = CCrmCompany::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
$currentItem = $dbRes->GetNext();
if (!is_array($currentItem)) {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_COMPANY_NOT_FOUND', array('#ID#' => $ID))));
}
}
$title = isset($data['TITLE']) ? $data['TITLE'] : '';
if ($title === '') {
__CrmMobileCompanyEditEndResonse(array('ERROR' => GetMessage('CRM_COMPANY_TITLE_NOT_ASSIGNED')));
}