本文整理汇总了PHP中CCrmSecurityHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CCrmSecurityHelper类的具体用法?PHP CCrmSecurityHelper怎么用?PHP CCrmSecurityHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCrmSecurityHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetUserWorkflowTaskCount
public static function GetUserWorkflowTaskCount($workflowIDs, $userID = 0)
{
if (!is_array($workflowIDs)) {
return 0;
}
if (!(IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc'))) {
return 0;
}
$userID = intval($userID);
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUserID();
}
$filter = array('USER_ID' => $userID);
$workflowQty = count($workflowIDs);
if ($workflowQty > 1) {
//IMPORTANT: will produce SQL error due to CBPTaskService::GetList bug
//$filter['@WORKFLOW_ID'] = $workflowIDs;
$filter['WORKFLOW_ID'] = $workflowIDs[0];
}
/*elseif($workflowQty === 1)
{
$filter['WORKFLOW_ID'] = $workflowIDs[0];
}*/
$result = CBPTaskService::GetList(array(), $filter, array(), false, array());
return is_int($result) ? $result : 0;
}
示例2: __construct
public function __construct(array $settings, $userID = 0, $enablePermissionCheck = true)
{
$this->settings = $settings;
if (!is_int($userID)) {
$userID = (int) $userID;
}
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
}
$this->userID = $userID;
if (!is_bool($enablePermissionCheck)) {
$enablePermissionCheck = (bool) $enablePermissionCheck;
}
$this->enablePermissionCheck = $enablePermissionCheck;
}
示例3: EnsureAllResponsibilityImported
public static function EnsureAllResponsibilityImported($userID, $reset = false)
{
$userID = intval($userID);
if ($userID <= 0) {
$userID = CCrmSecurityHelper::GetCurrentUser();
}
$reset = (bool) $reset;
$optionName = 'sl_subscr_import';
if ($reset || CUserOptions::GetOption('crm', $optionName, 'N', $userID) !== 'Y') {
self::EnsureResponsibilityImported(CCrmOwnerType::Lead, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Contact, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Company, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Deal, $userID);
self::EnsureResponsibilityImported(CCrmOwnerType::Activity, $userID);
CUserOptions::SetOption('crm', $optionName, 'Y', false, $userID);
}
}
示例4: __construct
protected function __construct(array $settings, Filter $filter, $userID = 0, $enablePermissionCheck = true)
{
$this->settings = $settings;
$this->filter = $filter;
$this->responsibleIDs = $this->filter->getResponsibleIDs();
if (!is_int($userID)) {
$userID = (int) $userID;
}
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
}
$this->userID = $userID;
if (!is_bool($enablePermissionCheck)) {
$enablePermissionCheck = (bool) $enablePermissionCheck;
}
$this->enablePermissionCheck = $enablePermissionCheck;
//Disable permission check if filter by current user is enabled.
if ($this->enablePermissionCheck && is_array($this->responsibleIDs) && count($this->responsibleIDs) === 1 && (int) $this->responsibleIDs[0] === $this->userID) {
$this->enablePermissionCheck = false;
}
}
示例5: checkCompletePermission
public static function checkCompletePermission($taskID, $userID = 0)
{
if (!is_int($userID)) {
$userID = (int) $userID;
}
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
}
if (!is_int($taskID)) {
$taskID = (int) $taskID;
}
$taskItem = self::getTaskItem($taskID, $userID);
if ($taskItem === null) {
return false;
}
try {
return $taskItem->isActionAllowed(\CTaskItem::ACTION_COMPLETE);
} catch (\TasksException $e) {
return false;
}
}
示例6: Header
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
if (!empty($result)) {
echo json_encode($result);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
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 ? CCrmContact::CheckUpdatePermission($ID) : CCrmContact::CheckCreatePermission();
if (!$hasPermission) {
__CrmMobileFileEndResonse(array('error' => 'Access denied.'));
} else {
$result = array();
if (!CCrmMobileHelper::TryUploadFile($result, array('OWNER_TYPE_ID' => CCrmOwnerType::Contact, '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);
示例7: array
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
global $APPLICATION;
$APPLICATION->SetAdditionalCSS('/bitrix/js/crm/css/crm.css');
$APPLICATION->IncludeComponent('bitrix:crm.control_panel', '', array('ID' => 'DEAL_WIDGET', 'ACTIVE_ITEM_ID' => 'DEAL', 'PATH_TO_COMPANY_LIST' => isset($arResult['PATH_TO_COMPANY_LIST']) ? $arResult['PATH_TO_COMPANY_LIST'] : '', 'PATH_TO_COMPANY_EDIT' => isset($arResult['PATH_TO_COMPANY_EDIT']) ? $arResult['PATH_TO_COMPANY_EDIT'] : '', 'PATH_TO_CONTACT_LIST' => isset($arResult['PATH_TO_CONTACT_LIST']) ? $arResult['PATH_TO_CONTACT_LIST'] : '', 'PATH_TO_DEAL_WIDGET' => isset($arResult['PATH_TO_DEAL_WIDGET']) ? $arResult['PATH_TO_DEAL_WIDGET'] : '', 'PATH_TO_DEAL_INDEX' => isset($arResult['PATH_TO_DEAL_INDEX']) ? $arResult['PATH_TO_DEAL_INDEX'] : '', 'PATH_TO_DEAL_LIST' => isset($arResult['PATH_TO_DEAL_LIST']) ? $arResult['PATH_TO_DEAL_LIST'] : '', 'PATH_TO_DEAL_EDIT' => isset($arResult['PATH_TO_DEAL_EDIT']) ? $arResult['PATH_TO_DEAL_EDIT'] : '', 'PATH_TO_LEAD_LIST' => isset($arResult['PATH_TO_LEAD_LIST']) ? $arResult['PATH_TO_LEAD_LIST'] : '', 'PATH_TO_LEAD_EDIT' => isset($arResult['PATH_TO_LEAD_EDIT']) ? $arResult['PATH_TO_LEAD_EDIT'] : '', 'PATH_TO_QUOTE_LIST' => isset($arResult['PATH_TO_QUOTE_LIST']) ? $arResult['PATH_TO_QUOTE_LIST'] : '', 'PATH_TO_QUOTE_EDIT' => isset($arResult['PATH_TO_QUOTE_EDIT']) ? $arResult['PATH_TO_QUOTE_EDIT'] : '', 'PATH_TO_INVOICE_LIST' => isset($arResult['PATH_TO_INVOICE_LIST']) ? $arResult['PATH_TO_INVOICE_LIST'] : '', 'PATH_TO_INVOICE_EDIT' => isset($arResult['PATH_TO_INVOICE_EDIT']) ? $arResult['PATH_TO_INVOICE_EDIT'] : '', 'PATH_TO_REPORT_LIST' => isset($arResult['PATH_TO_REPORT_LIST']) ? $arResult['PATH_TO_REPORT_LIST'] : '', 'PATH_TO_DEAL_FUNNEL' => isset($arResult['PATH_TO_DEAL_FUNNEL']) ? $arResult['PATH_TO_DEAL_FUNNEL'] : '', 'PATH_TO_EVENT_LIST' => isset($arResult['PATH_TO_EVENT_LIST']) ? $arResult['PATH_TO_EVENT_LIST'] : '', 'PATH_TO_PRODUCT_LIST' => isset($arResult['PATH_TO_PRODUCT_LIST']) ? $arResult['PATH_TO_PRODUCT_LIST'] : ''), $component);
?>
<div class="bx-crm-view"><?php
$APPLICATION->IncludeComponent('bitrix:crm.widget_panel', '', array('GUID' => 'deal_widget', 'ENTITY_TYPE' => 'DEAL', 'LAYOUT' => '50/50', 'NAVIGATION_CONTEXT_ID' => $arResult['NAVIGATION_CONTEXT_ID'], 'PATH_TO_WIDGET' => isset($arResult['PATH_TO_DEAL_WIDGET']) ? $arResult['PATH_TO_DEAL_WIDGET'] : '', 'PATH_TO_LIST' => isset($arResult['PATH_TO_DEAL_LIST']) ? $arResult['PATH_TO_DEAL_LIST'] : '', 'ROWS' => array(array('height' => 380, 'cells' => array(array('controls' => array(array('title' => GetMessage('CRM_DEAL_WGT_FUNNEL'), 'typeName' => 'funnel'))), array('controls' => array(array('typeName' => 'number', 'layout' => 'tiled', 'configs' => array(array('name' => 'sum1', 'title' => GetMessage('CRM_DEAL_WGT_SUM_DEAL_OVERALL'), 'dataPreset' => 'DEAL_SUM_STATS::OVERALL_SUM', 'dataSource' => 'DEAL_SUM_STATS', 'select' => array('name' => 'SUM_TOTAL', 'aggregate' => 'SUM'), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')), array('name' => 'sum2', 'title' => GetMessage('CRM_DEAL_WGT_SUM_DEAL_WON'), 'dataPreset' => 'DEAL_SUM_STATS::OVERALL_SUM', 'dataSource' => 'DEAL_SUM_STATS', 'select' => array('name' => 'SUM_TOTAL', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')), array('name' => 'diff', 'title' => GetMessage('CRM_DEAL_WGT_SUM_DEAL_IN_WORK'), 'dataSource' => array('name' => 'EXPRESSION', 'operation' => 'diff', 'arguments' => array('%sum1%', '%sum2%')), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')))))))), array('height' => 180, 'cells' => array(array('controls' => array(array('title' => GetMessage('CRM_DEAL_WGT_RATING'), 'typeName' => 'rating', 'group' => 'USER', 'nominee' => CCrmSecurityHelper::GetCurrentUserID(), 'configs' => array(array('name' => 'sum1', 'dataPreset' => 'DEAL_SUM_STATS::OVERALL_SUM', 'dataSource' => 'DEAL_SUM_STATS', 'select' => array('name' => 'SUM_TOTAL', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')))))))), array('height' => 380, 'cells' => array(array('controls' => array(array('typeName' => 'number', 'layout' => 'tiled', 'configs' => array(array('name' => 'sum1', 'title' => GetMessage('CRM_DEAL_WGT_SUM_INVOICE_OVERALL'), 'dataPreset' => 'DEAL_INVOICE_STATS::OVERALL_SUM', 'dataSource' => 'DEAL_INVOICE_STATS', 'select' => array('name' => 'TOTAL_INVOICE_SUM', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')), array('name' => 'sum2', 'title' => GetMessage('CRM_DEAL_WGT_SUM_INVOICE_OWED'), 'dataPreset' => 'DEAL_INVOICE_STATS::OVERALL_OWED_SUM', 'dataSource' => 'DEAL_INVOICE_STATS', 'select' => array('name' => 'TOTAL_OWED', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')), array('name' => 'sum3', 'title' => GetMessage('CRM_DEAL_WGT_SUM_DEAL_WON'), 'dataPreset' => 'DEAL_SUM_STATS::OVERALL_SUM', 'dataSource' => 'DEAL_SUM_STATS', 'select' => array('name' => 'SUM_TOTAL', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'format' => array('isCurrency' => 'Y', 'enableDecimals' => 'N')))))), array('controls' => array(array('title' => GetMessage('CRM_DEAL_WGT_PAYMENT_CONTROL'), 'typeName' => 'bar', 'group' => 'DATE', 'context' => 'F', 'combineData' => true, 'configs' => array(array('name' => 'sum1', 'title' => GetMessage('CRM_DEAL_WGT_SUM_INVOICE_OVERALL'), 'dataPreset' => 'DEAL_INVOICE_STATS::OVERALL_SUM', 'dataSource' => 'DEAL_INVOICE_STATS', 'select' => array('name' => 'TOTAL_INVOICE_SUM', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'display' => array('graph' => array('clustered' => 'N'), 'colorScheme' => 'green')), array('name' => 'sum2', 'title' => GetMessage('CRM_DEAL_WGT_SUM_INVOICE_OWED'), 'dataPreset' => 'DEAL_INVOICE_STATS::OVERALL_OWED_SUM', 'dataSource' => 'DEAL_INVOICE_STATS', 'select' => array('name' => 'TOTAL_OWED', 'aggregate' => 'SUM'), 'filter' => array('semanticID' => 'S'), 'display' => array('graph' => array('clustered' => 'N'), 'colorScheme' => 'red')))))))), array('height' => 380, 'cells' => array(array('controls' => array(array('title' => GetMessage('CRM_DEAL_WGT_DEAL_IN_WORK'), 'typeName' => 'graph', 'group' => 'DATE', 'context' => 'E', 'combineData' => true, 'configs' => array(array('name' => 'qty1', 'title' => GetMessage('CRM_DEAL_WGT_QTY_DEAL_IN_WORK'), 'dataPreset' => 'DEAL_IN_WORK::OVERALL_COUNT', 'dataSource' => 'DEAL_IN_WORK', 'select' => array('name' => 'COUNT')), array('name' => 'qty2', 'title' => GetMessage('CRM_DEAL_WGT_QTY_CALL'), 'dataPreset' => 'DEAL_ACTIVITY_STATS::CALL_OVERALL_COUNT', 'dataSource' => 'DEAL_ACTIVITY_STATS', 'select' => array('name' => 'CALL_QTY', 'aggregate' => 'SUM'), 'filter' => array()), array('name' => 'qty3', 'title' => GetMessage('CRM_DEAL_WGT_QTY_ACTIVITY'), 'dataPreset' => 'DEAL_ACTIVITY_STATS::OVERALL_COUNT', 'dataSource' => 'DEAL_ACTIVITY_STATS', 'select' => array('name' => 'TOTAL', 'aggregate' => 'SUM'), 'filter' => array()))))), array('controls' => array(array('typeName' => 'number', 'layout' => 'tiled', 'configs' => array(array('name' => 'qty1', 'title' => GetMessage('CRM_DEAL_WGT_QTY_DEAL_IN_WORK'), 'dataPreset' => 'DEAL_IN_WORK::OVERALL_COUNT', 'dataSource' => 'DEAL_IN_WORK', 'select' => array('name' => 'COUNT')), array('name' => 'qty2', 'title' => GetMessage('CRM_DEAL_WGT_QTY_ACTIVITY'), 'dataPreset' => 'DEAL_ACTIVITY_STATS::OVERALL_COUNT', 'dataSource' => 'DEAL_ACTIVITY_STATS', 'select' => array('name' => 'TOTAL', 'aggregate' => 'SUM'), 'filter' => array()), array('name' => 'qty3', 'title' => GetMessage('CRM_DEAL_WGT_QTY_CALL'), 'dataPreset' => 'DEAL_ACTIVITY_STATS::CALL_OVERALL_COUNT', 'dataSource' => 'DEAL_ACTIVITY_STATS', 'select' => array('name' => 'CALL_QTY', 'aggregate' => 'SUM'), 'filter' => array()))))))), array('height' => 180, 'cells' => array(array('controls' => array(array('typeName' => 'number', 'configs' => array(array('name' => 'qty1', 'title' => GetMessage('CRM_DEAL_WGT_QTY_DEAL_IDLE'), 'dataPreset' => 'DEAL_IDLE::OVERALL_COUNT', 'dataSource' => 'DEAL_IDLE', 'select' => array('name' => 'COUNT')))))))))));
?>
</div>
示例8: ShowError
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if ($userPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
global $APPLICATION;
$arResult['RUBRIC'] = array('ENABLED' => false);
$enablePaging = $arResult['ENABLE_PAGING'] = isset($_GET['PAGING']) && strtoupper($_GET['PAGING']) === 'Y';
$enableSearch = $arResult['ENABLE_SEARCH'] = isset($_GET['SEARCH']) && strtoupper($_GET['SEARCH']) === 'Y';
if ($enableSearch) {
// decode encodeURIComponent params
CUtil::JSPostUnescape();
}
$companyID = $arResult['COMPANY_ID'] = isset($_GET['company_id']) ? intval($_GET['company_id']) : 0;
$arResult['SHOW_SEARCH_PANEL'] = $companyID <= 0;
$currentUserID = $arResult['USER_ID'] = intval(CCrmSecurityHelper::GetCurrentUserID());
$arParams['CONTACT_EDIT_URL_TEMPLATE'] = isset($arParams['CONTACT_EDIT_URL_TEMPLATE']) ? $arParams['CONTACT_EDIT_URL_TEMPLATE'] : '';
$arParams['CONTACT_SHOW_URL_TEMPLATE'] = isset($arParams['CONTACT_SHOW_URL_TEMPLATE']) ? $arParams['CONTACT_SHOW_URL_TEMPLATE'] : '';
$arParams['COMPANY_SHOW_URL_TEMPLATE'] = isset($arParams['COMPANY_SHOW_URL_TEMPLATE']) ? $arParams['COMPANY_SHOW_URL_TEMPLATE'] : '';
$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$arParams['NAME_TEMPLATE'] = isset($arParams['NAME_TEMPLATE']) ? str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']) : CSite::GetNameFormat(false);
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
$arParams['UID'] = 'mobile_crm_contact_list';
}
$arResult['UID'] = $arParams['UID'];
/*
$arParams['PULL_TAG'] = $arResult['PULL_TAG'] = isset($arParams['PULL_TAG']) ? $arParams['PULL_TAG'] : 'CRM_CONTACT_CHANGE';
$arParams['PULL_UPDATE_CMD'] = $arResult['PULL_UPDATE_CMD'] = isset($arParams['PULL_UPDATE_CMD']) ? $arParams['PULL_UPDATE_CMD'] : 'crm_contact_update';
$arParams['PULL_DELETE_CMD'] = $arResult['PULL_DELETE_CMD'] = isset($arParams['PULL_DELETE_CMD']) ? $arParams['PULL_DELETE_CMD'] : 'crm_contact_delete';
*/
示例9: define
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/bx_root.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if (!defined('LANGUAGE_ID')) {
$dbSite = CSite::GetByID(SITE_ID);
$arSite = $dbSite ? $dbSite->Fetch() : null;
define('LANGUAGE_ID', $arSite ? $arSite['LANGUAGE_ID'] : 'en');
}
//session_write_close();
if (!CModule::IncludeModule('crm')) {
die;
}
if (CModule::IncludeModule('compression')) {
CCompress::Disable2048Spaces();
}
global $APPLICATION, $DB;
$curUser = CCrmSecurityHelper::GetCurrentUser();
if (!$curUser || !$curUser->IsAuthorized() || !check_bitrix_sessid() || $_SERVER['REQUEST_METHOD'] != 'POST') {
die;
}
//$langID = isset($_REQUEST['lang_id'])? $_REQUEST['lang_id']: LANGUAGE_ID;
//__IncludeLang(dirname(__FILE__).'/lang/'.$langID.'/'.basename(__FILE__));
CUtil::JSPostUnescape();
if (!function_exists('__CrmMobileDealEditEndResonse')) {
function __CrmMobileDealEditEndResonse($result)
{
$GLOBALS['APPLICATION']->RestartBuffer();
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
if (!empty($result)) {
echo CUtil::PhpToJSObject($result);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
示例10: CrmCheckPath
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule('crm')) {
return;
}
$currentUserID = CCrmSecurityHelper::GetCurrentUserID();
$CrmPerms = CCrmPerms::GetCurrentUserPermissions();
if ($CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) {
return;
}
$arParams['PATH_TO_DEAL_LIST'] = CrmCheckPath('PATH_TO_DEAL_LIST', $arParams['PATH_TO_DEAL_LIST'], $APPLICATION->GetCurPage());
$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_DEAL_IMPORT'] = CrmCheckPath('PATH_TO_DEAL_IMPORT', $arParams['PATH_TO_DEAL_IMPORT'], $APPLICATION->GetCurPage() . '?import');
$arParams['ELEMENT_ID'] = isset($arParams['ELEMENT_ID']) ? intval($arParams['ELEMENT_ID']) : 0;
if (!isset($arParams['TYPE'])) {
$arParams['TYPE'] = 'list';
}
if (isset($_REQUEST['copy'])) {
$arParams['TYPE'] = 'copy';
}
$toolbarID = 'toolbar_deal_' . $arParams['TYPE'];
if ($arParams['ELEMENT_ID'] > 0) {
$toolbarID .= '_' . $arParams['ELEMENT_ID'];
}
$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
示例11: Delete
public function Delete($ID, $arEntityAttr)
{
if (!CModule::IncludeModule('bizproc')) {
return true;
}
$userID = CCrmSecurityHelper::GetCurrentUserID();
$bDeleteError = !CBPDocument::CanUserOperateDocument(CBPCanUserOperateOperation::WriteDocument, $userID, array('crm', $this->sDocument, $this->sEntityType . '_' . $ID), array('UserGroups' => $this->arCurrentUserGroups, 'UserIsAdmin' => CCrmPerms::IsAdmin($userID), 'CRMEntityAttr' => $arEntityAttr));
if (!$bDeleteError) {
return $this->ProcessDeletion($ID);
}
return true;
}
示例12: __CrmConfigFieldEditEndResonse
if (!empty($result)) {
echo CUtil::PhpToJSObject($result);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/epilog_after.php';
die;
}
}
if (!CModule::IncludeModule('crm')) {
__CrmConfigFieldEditEndResonse(array('ERROR' => 'Could not include crm module.'));
}
/*
* ONLY 'POST' METHOD SUPPORTED
* SUPPORTED ACTIONS:
* 'ADD_FIELD' - add new field
*/
if (!CCrmSecurityHelper::IsAuthorized() || !check_bitrix_sessid()) {
__CrmConfigFieldEditEndResonse(array('ERROR' => 'Access denied.'));
}
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
__CrmConfigFieldEditEndResonse(array('ERROR' => 'Request method is not allowed.'));
}
CUtil::JSPostUnescape();
$action = isset($_POST['ACTION']) ? $_POST['ACTION'] : '';
if ($action === 'ADD_FIELD') {
if (!CCrmAuthorizationHelper::CheckConfigurationUpdatePermission()) {
__CrmConfigFieldEditEndResonse(array('ERROR' => 'Access denied.'));
}
$data = isset($_POST['DATA']) && is_array($_POST['DATA']) ? $_POST['DATA'] : array();
if (count($data) == 0) {
__CrmConfigFieldEditEndResonse(array('ERROR' => "The parameter 'data' is not found or empty."));
}
示例13: saveFile
/**
* @param array $fileData
* @param string $siteID
* @param array $params
* @return int|false
*/
public static function saveFile(array $fileData, $siteID = '', $params = array())
{
if (!(IsModuleInstalled('disk') && Loader::includeModule('disk'))) {
return false;
}
if ($siteID === '') {
$siteID = self::getDefaultSiteID();
}
if (!is_array($params)) {
$params = array();
}
$typeID = isset($params['TYPE_ID']) ? (int) $params['TYPE_ID'] : StorageFileType::Undefined;
if (!StorageFileType::IsDefined($typeID)) {
$typeID = StorageFileType::EmailAttachment;
}
$folder = self::ensureFolderCreated($typeID, $siteID);
if (!$folder) {
return false;
}
$userID = isset($params['USER_ID']) ? (int) $params['USER_ID'] : 0;
if ($userID <= 0) {
$userID = \CCrmSecurityHelper::GetCurrentUserID();
} else {
if ($userID <= 0) {
$userID = SystemUser::SYSTEM_USER_ID;
}
}
$file = $folder->addFile(array('NAME' => Text::correctFilename($fileData['ORIGINAL_NAME']), 'FILE_ID' => (int) $fileData['ID'], 'SIZE' => (int) $fileData['FILE_SIZE'], 'CREATED_BY' => $userID), array(), true);
return $file ? $file->getId() : false;
}
示例14: Delete
public function Delete($ID, $arOptions = array())
{
global $DB, $APPLICATION;
$ID = intval($ID);
$iUserId = CCrmSecurityHelper::GetCurrentUserID();
$sWherePerm = '';
if ($this->bCheckPermission) {
$arEntityAttr = $this->cPerms->GetEntityAttr('COMPANY', $ID);
$sEntityPerm = $this->cPerms->GetPermType('COMPANY', 'DELETE', $arEntityAttr[$ID]);
if ($sEntityPerm == BX_CRM_PERM_NONE) {
return false;
} else {
if ($sEntityPerm == BX_CRM_PERM_SELF) {
$sWherePerm = " AND ASSIGNED_BY_ID = {$iUserId}";
} else {
if ($sEntityPerm == BX_CRM_PERM_OPEN) {
$sWherePerm = " AND (OPENED = 'Y' OR ASSIGNED_BY_ID = {$iUserId})";
}
}
}
}
$APPLICATION->ResetException();
$events = GetModuleEvents('crm', 'OnBeforeCrmCompanyDelete');
while ($arEvent = $events->Fetch()) {
if (ExecuteModuleEventEx($arEvent, array($ID)) === false) {
$err = GetMessage("MAIN_BEFORE_DEL_ERR") . ' ' . $arEvent['TO_NAME'];
if ($ex = $APPLICATION->GetException()) {
$err .= ': ' . $ex->GetString();
}
$APPLICATION->throwException($err);
return false;
}
}
$obRes = $DB->Query("DELETE FROM b_crm_company WHERE ID = {$ID}{$sWherePerm}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
if (is_object($obRes) && $obRes->AffectedRowsCount() > 0) {
$DB->Query("DELETE FROM b_crm_entity_perms WHERE ENTITY='COMPANY' AND ENTITY_ID = {$ID}", false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
$GLOBALS['USER_FIELD_MANAGER']->Delete(self::$sUFEntityID, $ID);
$CCrmFieldMulti = new CCrmFieldMulti();
$CCrmFieldMulti->DeleteByElement('COMPANY', $ID);
$CCrmEvent = new CCrmEvent();
$CCrmEvent->DeleteByElement('COMPANY', $ID);
\Bitrix\Crm\Integrity\DuplicateEntityRanking::unregisterEntityStatistics(CCrmOwnerType::Company, $ID);
\Bitrix\Crm\Integrity\DuplicateOrganizationCriterion::unregister(CCrmOwnerType::Company, $ID);
\Bitrix\Crm\Integrity\DuplicateCommunicationCriterion::unregister(CCrmOwnerType::Company, $ID);
\Bitrix\Crm\Integrity\DuplicateIndexMismatch::unregisterEntity(CCrmOwnerType::Company, $ID);
$enableDupIndexInvalidation = is_array($arOptions) && isset($arOptions['ENABLE_DUP_INDEX_INVALIDATION']) ? (bool) $arOptions['ENABLE_DUP_INDEX_INVALIDATION'] : true;
if ($enableDupIndexInvalidation) {
\Bitrix\Crm\Integrity\DuplicateIndexBuilder::markAsJunk(CCrmOwnerType::Company, $ID);
}
CCrmActivity::DeleteByOwner(CCrmOwnerType::Company, $ID);
CCrmSearch::DeleteSearch('COMPANY', $ID);
CCrmSonetSubscription::UnRegisterSubscriptionByEntity(CCrmOwnerType::Company, $ID);
CCrmLiveFeed::DeleteLogEvents(array('ENTITY_TYPE_ID' => CCrmOwnerType::Company, 'ENTITY_ID' => $ID));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("crm_entity_name_" . CCrmOwnerType::Company . "_" . $ID);
}
}
return true;
}
示例15: GetCurrentUserAttr
public static function GetCurrentUserAttr()
{
return self::GetUserAttr(CCrmSecurityHelper::GetCurrentUserID());
}