本文整理汇总了PHP中CCrmDeal::CheckCreatePermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmDeal::CheckCreatePermission方法的具体用法?PHP CCrmDeal::CheckCreatePermission怎么用?PHP CCrmDeal::CheckCreatePermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmDeal
的用法示例。
在下文中一共展示了CCrmDeal::CheckCreatePermission方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$toolbarID .= '_' . $arParams['ELEMENT_ID'];
}
$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
$bRead = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ');
$bExport = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'EXPORT');
$bImport = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'IMPORT');
$bAdd = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'ADD');
$bWrite = !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'WRITE');
$bDelete = false;
} else {
$bExport = false;
$bImport = false;
$bRead = CCrmDeal::CheckReadPermission($arParams['ELEMENT_ID'], $CrmPerms);
$bAdd = CCrmDeal::CheckCreatePermission($CrmPerms);
$bWrite = CCrmDeal::CheckUpdatePermission($arParams['ELEMENT_ID'], $CrmPerms);
$bDelete = CCrmDeal::CheckDeletePermission($arParams['ELEMENT_ID'], $CrmPerms);
}
if (!$bRead && !$bAdd && !$bWrite) {
return false;
}
if ($arParams['TYPE'] === 'list') {
if ($bAdd) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('DEAL_ADD'), 'TITLE' => GetMessage('DEAL_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_EDIT'], array('deal_id' => 0)), 'HIGHLIGHT' => true);
}
if ($bImport) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('DEAL_IMPORT'), 'TITLE' => GetMessage('DEAL_IMPORT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_DEAL_IMPORT'], array()), 'ICON' => 'btn-import');
}
if ($bExport) {
$arResult['BUTTONS'][] = array('TITLE' => GetMessage('DEAL_EXPORT_CSV_TITLE'), 'TEXT' => GetMessage('DEAL_EXPORT_CSV'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'csv', 'ncc' => '1')), 'ICON' => 'btn-export');
示例2: 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 !== CCrmOwnerType::DealName) {
__CrmMobileDealEditEndResonse(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) {
__CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_DATA_NOT_FOUND')));
}
$ID = isset($data['ID']) ? intval($data['ID']) : 0;
$isNew = $ID <= 0;
$hasPermission = $isNew ? CCrmDeal::CheckCreatePermission() : CCrmDeal::CheckUpdatePermission($ID);
if (!$hasPermission) {
__CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
}
$currentItem = null;
if (!$isNew) {
$dbRes = CCrmDeal::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
$currentItem = $dbRes->GetNext();
if (!is_array($currentItem)) {
__CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_DEAL_NOT_FOUND', array('#ID#' => $ID))));
}
}
$title = isset($data['TITLE']) ? $data['TITLE'] : '';
if ($title === '') {
__CrmMobileDealEditEndResonse(array('ERROR' => GetMessage('CRM_DEAL_TITLE_NOT_ASSIGNED')));
}
示例3: 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 '';
}
}
示例4: PrepareConversionPermissionFlags
public static function PrepareConversionPermissionFlags($ID, array &$params, $userPermissions = null)
{
if (!$userPermissions) {
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
}
$canCreateDeal = CCrmDeal::CheckCreatePermission($userPermissions);
$canCreateInvoice = IsModuleInstalled('sale') && CCrmInvoice::CheckCreatePermission($userPermissions);
$params['CAN_CONVERT_TO_DEAL'] = $canCreateDeal;
$params['CAN_CONVERT_TO_INVOICE'] = $canCreateInvoice;
$params['CAN_CONVERT'] = $params['CONVERT'] = $canCreateInvoice || $canCreateDeal;
$restriction = \Bitrix\Crm\Restriction\RestrictionManager::getConversionRestriction();
if ($restriction->hasPermission()) {
$params['CONVERSION_PERMITTED'] = true;
} else {
$params['CONVERSION_PERMITTED'] = false;
$params['CONVERSION_LOCK_SCRIPT'] = $restriction->preparePopupScript();
}
}
示例5: CrmCheckPath
$arParams['PATH_TO_PRODUCT_EDIT'] = CrmCheckPath('PATH_TO_PRODUCT_EDIT', $arParams['PATH_TO_PRODUCT_EDIT'], $APPLICATION->GetCurPage() . '?product_id=#product_id#&edit');
$arParams['PATH_TO_PRODUCT_SHOW'] = CrmCheckPath('PATH_TO_PRODUCT_SHOW', $arParams['PATH_TO_PRODUCT_SHOW'], $APPLICATION->GetCurPage() . '?product_id=#product_id#&show');
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$arParams['ELEMENT_ID'] = isset($arParams['ELEMENT_ID']) ? (int) $arParams['ELEMENT_ID'] : 0;
$bEdit = false;
$bCopy = false;
$bVarsFromForm = false;
if (!empty($arParams['ELEMENT_ID'])) {
$bEdit = true;
}
if (!empty($_REQUEST['copy'])) {
$bCopy = true;
$bEdit = false;
}
$bConvert = isset($arParams['CONVERT']) && $arParams['CONVERT'];
$isPermitted = $bEdit ? CCrmDeal::CheckUpdatePermission($arParams['ELEMENT_ID'], $userPermissions) : CCrmDeal::CheckCreatePermission($userPermissions);
if (!$isPermitted) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
$arEntityAttr = $arParams['ELEMENT_ID'] > 0 ? $userPermissions->GetEntityAttr('DEAL', array($arParams['ELEMENT_ID'])) : array();
$bInternal = false;
if (isset($arParams['INTERNAL_FILTER']) && !empty($arParams['INTERNAL_FILTER'])) {
$bInternal = true;
}
$arResult['INTERNAL'] = $bInternal;
$bTaxMode = CCrmTax::isTaxMode();
$arResult['TAX_MODE'] = $bTaxMode ? 'Y' : 'N';
$arFields = null;
if ($bEdit || $bCopy) {
$arFilter = array('ID' => $arParams['ELEMENT_ID'], 'PERMISSION' => 'WRITE');
示例6: 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($_REQUEST['deal_id'])) {
$entityID = $arParams['ENTITY_ID'] = intval($_REQUEST['deal_id']);
}
$arResult['ENTITY_ID'] = $entityID;
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!($entityID > 0 ? CCrmDeal::CheckUpdatePermission($entityID, $userPerms) : CCrmDeal::CheckCreatePermission($userPerms))) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
global $APPLICATION;
$arParams['DEAL_SHOW_URL_TEMPLATE'] = isset($arParams['DEAL_SHOW_URL_TEMPLATE']) ? $arParams['DEAL_SHOW_URL_TEMPLATE'] : '';
$arParams['DEAL_EDIT_URL_TEMPLATE'] = isset($arParams['DEAL_EDIT_URL_TEMPLATE']) ? $arParams['DEAL_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['CURRENCY_SELECTOR_URL_TEMPLATE'] = isset($arParams['CURRENCY_SELECTOR_URL_TEMPLATE']) ? $arParams['CURRENCY_SELECTOR_URL_TEMPLATE'] : '';
$arParams['PRODUCT_ROW_EDIT_URL_TEMPLATE'] = isset($arParams['PRODUCT_ROW_EDIT_URL_TEMPLATE']) ? $arParams['PRODUCT_ROW_EDIT_URL_TEMPLATE'] : '';
$arParams['PRODUCT_SELECTOR_URL_TEMPLATE'] = isset($arParams['PRODUCT_SELECTOR_URL_TEMPLATE']) ? $arParams['PRODUCT_SELECTOR_URL_TEMPLATE'] : '';
$arParams['CLIENT_SELECTOR_URL_TEMPLATE'] = isset($arParams['CLIENT_SELECTOR_URL_TEMPLATE']) ? $arParams['CLIENT_SELECTOR_URL_TEMPLATE'] : '';
$arParams['DEAL_STAGE_SELECTOR_URL_TEMPLATE'] = isset($arParams['DEAL_STAGE_SELECTOR_URL_TEMPLATE']) ? $arParams['DEAL_STAGE_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'] : '';
示例7: innerAdd
protected function innerAdd(&$fields, &$errors, array $params = null)
{
if (!CCrmDeal::CheckCreatePermission()) {
$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->Add($fields, true, $options);
if ($result <= 0) {
$errors[] = $entity->LAST_ERROR;
} elseif (self::isBizProcEnabled()) {
CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Deal, $result, CCrmBizProcEventType::Create, $errors);
}
return $result;
}
示例8: PrepareConversionPermissionFlags
public static function PrepareConversionPermissionFlags($ID, array &$params, $userPermissions = null)
{
if (!$userPermissions) {
$userPermissions = CCrmPerms::GetCurrentUserPermissions();
}
$canEdit = CCrmAuthorizationHelper::CheckUpdatePermission(self::$TYPE_NAME, $ID, $userPermissions);
$canCreateContact = CCrmContact::CheckCreatePermission($userPermissions);
$canCreateCompany = CCrmCompany::CheckCreatePermission($userPermissions);
$canCreateDeal = CCrmDeal::CheckCreatePermission($userPermissions);
$params['CAN_CONVERT_TO_CONTACT'] = $canEdit && $canCreateContact;
$params['CAN_CONVERT_TO_COMPANY'] = $canEdit && $canCreateCompany;
$params['CAN_CONVERT_TO_DEAL'] = $canEdit && $canCreateDeal;
$params['CAN_CONVERT'] = $params['CONVERT'] = $canEdit && ($canCreateContact || $canCreateCompany || $canCreateDeal);
$params['CONVERSION_PERMITTED'] = true;
}