本文整理汇总了PHP中CCrmSecurityHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CCrmSecurityHelper类的具体用法?PHP CCrmSecurityHelper怎么用?PHP CCrmSecurityHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCrmSecurityHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:26,代码来源:crm_bizproc_helper.php
示例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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:15,代码来源:datasource.php
示例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);
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:17,代码来源:sonet_subscription.php
示例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;
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:widget.php
示例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;
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:21,代码来源:taskmanager.php
示例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);
开发者ID:pitnan,项目名称:u136056,代码行数:31,代码来源:file.php
示例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>
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:13,代码来源:widget.php
示例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';
*/
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例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';
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.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') {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php
示例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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:12,代码来源:crm_bizproc.php
示例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."));
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php
示例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;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:36,代码来源:diskmanager.php
示例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;
}
开发者ID:konvita2,项目名称:portal,代码行数:59,代码来源:crm_company.php
示例15: GetCurrentUserAttr
public static function GetCurrentUserAttr()
{
return self::GetUserAttr(CCrmSecurityHelper::GetCurrentUserID());
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:4,代码来源:crm_perms.php
示例16: define
<?php
define('STOP_STATISTICS', true);
define('BX_SECURITY_SHOW_MESSAGE', true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php';
if (!CModule::IncludeModule('crm')) {
return;
}
if (!CCrmSecurityHelper::IsAuthorized() || $_REQUEST['MODE'] != 'SEARCH') {
return;
}
$bResultWithValue = isset($_REQUEST['RESULT_WITH_VALUE']) && $_REQUEST['RESULT_WITH_VALUE'] === 'Y';
$CrmPerms = CCrmPerms::GetCurrentUserPermissions();
if (!(CCrmPerms::IsAccessEnabled($CrmPerms) && $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'))) {
return;
}
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
CUtil::JSPostUnescape();
$GLOBALS['APPLICATION']->RestartBuffer();
$search = trim($_REQUEST['VALUE']);
$multi = isset($_REQUEST['MULTI']) && $_REQUEST['MULTI'] == 'Y' ? true : false;
$arData = array();
$enableSearchByID = true;
if (isset($_REQUEST['ENABLE_SEARCH_BY_ID'])) {
$enableSearchByID = strtoupper($_REQUEST['ENABLE_SEARCH_BY_ID']) === 'Y';
}
if ($enableSearchByID && is_numeric($search)) {
$arFilter['ID'] = (int) $search;
} elseif (preg_match('/(.*)\\[(\\d+?)\\]/i' . BX_UTF_PCRE_MODIFIER, $search, $arMatches)) {
$arFilter['ID'] = intval($arMatches[2]);
$arFilter['%NAME'] = trim($arMatches[1]);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:list.ajax.php
示例17: CrmCheckPath
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
if (!CModule::IncludeModule('crm')) {
return false;
}
$arGadgetParams['PATH_TO_FULL_VIEW'] = CrmCheckPath('PATH_TO_FULL_VIEW', $arGadgetParams['PATH_TO_FULL_VIEW'], COption::GetOptionString('crm', 'path_to_activity_list'));
if (!is_array($arGadgetParams) || !array_key_exists('ITEM_COUNT', $arGadgetParams) || $arGadgetParams['ITEM_COUNT'] <= 0) {
$arGadgetParams['ITEM_COUNT'] = 5;
}
global $APPLICATION;
$APPLICATION->IncludeComponent('bitrix:crm.activity.list', 'gadget', array('PERMISSION_TYPE' => 'WRITE', 'ENABLE_TOOLBAR' => false, 'ENABLE_NAVIGATION' => true, 'DISPLAY_REFERENCE' => true, 'DISPLAY_CLIENT' => true, 'AJAX_MODE' => 'N', 'PREFIX' => 'GADGET_MY_ACTIVITIES', 'ITEM_COUNT' => $arGadgetParams['ITEM_COUNT'], 'PATH_TO_FULL_VIEW' => $arGadgetParams['PATH_TO_FULL_VIEW'], 'DEFAULT_FILTER' => array('LOGIC' => 'AND', 'RESPONSIBLE_ID' => CCrmSecurityHelper::GetCurrentUserID(), '__INNER_FILTER_RECENT_CHANGED' => array('LOGIC' => 'OR', 'COMPLETED' => 'N', '>=LAST_UPDATED' => ConvertTimeStamp(AddToTimeStamp(array('HH' => -1), time() + CTimeZone::GetOffset()), 'FULL')))), false, array('HIDE_ICONS' => 'Y'));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:14,代码来源:index.php
示例18: createInvoices
public function createInvoices(array $params)
{
$count = isset($params['COUNT']) ? (int) $params['COUNT'] : 0;
if ($count <= 0) {
return;
}
$sum = isset($params['SUM']) ? (int) $params['SUM'] : 0;
if ($sum <= 0) {
return;
}
$dealID = isset($params['DEAL_ID']) ? (int) $params['DEAL_ID'] : 0;
$companyID = isset($params['COMPANY_ID']) ? (int) $params['COMPANY_ID'] : 0;
$contactID = isset($params['CONTACT_ID']) ? (int) $params['CONTACT_ID'] : 0;
$userIDs = isset($params['USER_IDS']) && is_array($params['USER_IDS']) ? $params['USER_IDS'] : array();
if (empty($userIDs)) {
$userIDs[] = \CCrmSecurityHelper::GetCurrentUserID();
}
$prefix = isset($params['PREFIX']) ? $params['PREFIX'] : '';
if ($prefix === '') {
$prefix = $this->id;
}
$date = isset($params['DATE']) ? $params['DATE'] : null;
if (!$date) {
$date = $date = new Date();
}
$maxDateOffset = isset($params['MAX_DATE_OFFSET']) ? (int) $params['MAX_DATE_OFFSET'] : 0;
$dateFormat = Date::convertFormatToPhp(FORMAT_DATE);
$dateTimeFormat = Date::convertFormatToPhp(FORMAT_DATETIME);
$isWon = isset($params['IS_WON']) ? $params['IS_WON'] : false;
if ($isWon) {
$totalSum = $sum;
} else {
$totalSum = $sum - mt_rand((int) ($sum / 3), $sum);
}
$entity = new \CCrmInvoice(false);
$invoiceSum = (int) $totalSum / $count;
$totalInvoiceSum = 0;
for ($i = 1; $i <= $count; $i++) {
if ($i == $count) {
$invoiceSum = $totalSum - $totalInvoiceSum;
}
$totalInvoiceSum += $invoiceSum;
$time = DateTime::createFromTimestamp($date->getTimestamp());
if ($maxDateOffset > 0) {
$time->add(mt_rand(0, $maxDateOffset) . ' days');
}
$time->setTime(mt_rand(8, 20), mt_rand(0, 59), 0);
$siteTime = $time->format($dateTimeFormat);
$siteDate = $time->format($dateFormat);
\CCrmOwnerType::GetCaption(\CCrmOwnerType::Company, $companyID, false);
$companyInfo = self::getCompanyInfo($companyID);
$contactInfo = self::getContactInfo($contactID);
$fields = array('ORDER_TOPIC' => "{$prefix} invoice # {$i}", 'STATUS_ID' => $isWon ? 'P' : 'N', 'DATE_INSERT' => $siteTime, 'DATE_BILL' => $siteDate, 'RESPONSIBLE_ID' => self::getRandomItem($userIDs), 'UF_DEAL_ID' => $dealID, 'UF_COMPANY_ID' => $companyID, 'UF_CONTACT_ID' => $contactID, 'PERSON_TYPE_ID' => 1, 'PAY_SYSTEM_ID' => 1, 'INVOICE_PROPERTIES' => array(10 => $companyInfo['TITLE'], 11 => $companyInfo['FULL_ADDRESS'], 12 => $contactInfo['FULL_NAME'], 13 => $contactInfo['EMAIL'], 14 => $contactInfo['PHONE']), 'PRODUCT_ROWS' => array(array('ID' => 0, 'PRODUCT_NAME' => "{$prefix} product", 'QUANTITY' => 1, 'PRICE' => $invoiceSum, 'PRODUCT_ID' => 0, 'CUSTOMIZED' => 'Y')));
$ID = $entity->Add($fields);
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:56,代码来源:datagenerator.php
示例19: GetSubSelect
private static function GetSubSelect($arLogFields, $bDecrement = false)
{
global $DB;
$author_id = CCrmSecurityHelper::GetCurrentUserID();
if ($author_id <= 0 && isset($arLogFields["USER_ID"])) {
$author_id = intval($arLogFields["USER_ID"]);
}
if ($author_id <= 0) {
return "";
}
$entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($arLogFields["ENTITY_TYPE"]);
$entityID = $arLogFields["ENTITY_ID"];
$arEntities = array();
if ($entityTypeID == CCrmOwnerType::Activity) {
if ($arActivity = CCrmActivity::GetByID($entityID)) {
$entityTypeID = $arActivity["OWNER_TYPE_ID"];
$entityID = $arActivity["OWNER_ID"];
$entityName = CCrmOwnerType::ResolveName($entityTypeID);
$bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
$responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0) {
if (!array_key_exists($entityName, $arEntities)) {
$arEntities[$entityName] = array();
}
$arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
}
$arCommunications = CCrmActivity::GetCommunications($arActivity["ID"]);
foreach ($arCommunications as $arActivityCommunication) {
$entityTypeID = $arActivityCommunication["ENTITY_TYPE_ID"];
$entityID = $arActivityCommunication["ENTITY_ID"];
$entityName = CCrmOwnerType::ResolveName($entityTypeID);
$bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
$responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0) {
if (!array_key_exists($entityName, $arEntities)) {
$arEntities[$entityName] = array();
}
$arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
}
}
}
} elseif ($entityTypeID == CCrmOwnerType::Invoice) {
if ($arInvoice = CCrmInvoice::GetByID($entityID)) {
$arBindings = array(CCrmOwnerType::Contact => $arInvoice["UF_CONTACT_ID"], CCrmOwnerType::Company => $arInvoice["UF_COMPANY_ID"], CCrmOwnerType::Deal => $arInvoice["UF_DEAL_ID"]);
foreach ($arBindings as $entityTypeID => $entityID) {
if (intval($entityID) > 0) {
$entityName = CCrmOwnerType::ResolveName($entityTypeID);
$bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
$responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
if ($entityName && intval($responsible_id) > 0) {
if (!array_key_exists($entityName, $arEntities)) {
$arEntities[$entityName] = array();
}
$arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
}
}
}
}
} else {
$entityName = CCrmOwnerType::ResolveName($entityTypeID);
$bOpened = CCrmOwnerType::isOpened($entityTypeID, $entityID, false);
$responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0) {
if (!array_key_exists($entityName, $arEntities)) {
$arEntities[$entityName] = array();
}
$arEntities[$entityName][$entityTypeID . "_" . $entityID] = array("ENTITY_TYPE_ID" => $entityTypeID, "ENTITY_ID" => $entityID, "ENTITY_NAME" => $entityName, "IS_OPENED" => $bOpened, "RESPONSIBLE_ID" => $responsible_id);
}
}
if (intval($arLogFields["LOG_ID"]) > 0 && in_array($arLogFields["EVENT_ID"], array("crm_lead_message", "crm_deal_message", "crm_contact_message", "crm_company_message"))) {
$dbRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arLogFields["LOG_ID"]));
while ($arRight = $dbRight->Fetch()) {
if (preg_match('/^(' . CCrmLiveFeedEntity::Contact . '|' . CCrmLiveFeedEntity::Lead . '|' . CCrmLiveFeedEntity::Company . '|' . CCrmLiveFeedEntity::Deal . ')(\\d+)$/', $arRight["GROUP_CODE"], $matches)) {
$entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($matches[1]);
$entityID = $matches[2];
$entityName = CCrmOwnerType::ResolveName($entityTypeID);
$responsible_id = CCrmOwnerType::GetResponsibleID($entityTypeID, $entityID, false);
if (!array_key_exists($entityName, $arEntities)) {
$arEntities[$entityName] = array();
}
if (intval($entityID) > 0 && $entityName && intval($responsible_id) > 0 && !array_key_exists($entityTypeID . "_" . $entityID, $arEntities[$entityName])) {
$arEntities[$entityName][$entityTypeID . &
|
请发表评论