本文整理汇总了PHP中CCrmCompany::CheckCreatePermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmCompany::CheckCreatePermission方法的具体用法?PHP CCrmCompany::CheckCreatePermission怎么用?PHP CCrmCompany::CheckCreatePermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmCompany
的用法示例。
在下文中一共展示了CCrmCompany::CheckCreatePermission方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 '';
}
}
示例2: isset
$closeDate = isset($arResult['ELEMENT']['CLOSEDATE']) ? $arResult['ELEMENT']['CLOSEDATE'] : '';
$arResult['FIELDS']['tab_1'][] = array('id' => 'BEGINDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_BEGINDATE'), 'params' => array('sale_order_marker' => 'Y'), 'type' => 'date_link', 'value' => $beginDate !== '' ? ConvertTimeStamp(MakeTimeStamp($beginDate), 'SHORT', SITE_ID) : '');
$arResult['FIELDS']['tab_1'][] = array('id' => 'CLOSEDATE', 'name' => GetMessage('CRM_QUOTE_FIELD_CLOSEDATE'), 'type' => 'date_short', 'value' => $closeDate !== '' ? ConvertTimeStamp(MakeTimeStamp($closeDate), 'SHORT', SITE_ID) : '', 'params' => array('class' => 'bx-crm-dialog-input bx-crm-dialog-input-date'));
if (CCrmLead::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'LEAD_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LEAD_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'LEAD', 'INPUT_NAME' => 'LEAD_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['LEAD_ID']) ? $arResult['ELEMENT']['LEAD_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmDeal::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'DEAL_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_DEAL_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'DEAL', 'INPUT_NAME' => 'DEAL_ID', 'NEW_INPUT_NAME' => '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['DEAL_ID']) ? $arResult['ELEMENT']['DEAL_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
$arResult['FIELDS']['tab_1'][] = array('id' => 'OPENED', 'name' => GetMessage('CRM_QUOTE_FIELD_OPENED'), 'type' => 'vertical_checkbox', 'params' => array(), 'value' => isset($arResult['ELEMENT']['OPENED']) ? $arResult['ELEMENT']['OPENED'] : true, 'title' => GetMessage('CRM_QUOTE_FIELD_OPENED_TITLE'));
$arResult['FIELDS']['tab_1'][] = array('id' => 'section_contact_info', 'name' => GetMessage('CRM_SECTION_CLIENT_INFO'), 'type' => 'section');
if (CCrmContact::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'CONTACT_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_CONTACT_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'CONTACT', 'INPUT_NAME' => 'CONTACT_ID', 'NEW_INPUT_NAME' => CCrmContact::CheckCreatePermission() ? 'NEW_CONTACT_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['CONTACT_ID']) ? $arResult['ELEMENT']['CONTACT_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if (CCrmCompany::CheckReadPermission()) {
$arResult['FIELDS']['tab_1'][] = array('id' => 'COMPANY_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_COMPANY_ID'), 'type' => 'crm_entity_selector', 'componentParams' => array('ENTITY_TYPE' => 'COMPANY', 'INPUT_NAME' => 'COMPANY_ID', 'NEW_INPUT_NAME' => CCrmCompany::CheckCreatePermission() ? 'NEW_COMPANY_ID' : '', 'INPUT_VALUE' => isset($arResult['ELEMENT']['COMPANY_ID']) ? $arResult['ELEMENT']['COMPANY_ID'] : '', 'FORM_NAME' => $arResult['FORM_ID'], 'MULTIPLE' => 'N', 'NAME_TEMPLATE' => \Bitrix\Crm\Format\PersonNameFormatter::getFormat()));
}
if ($bTaxMode) {
// CLIENT LOCATION
$sLocationHtml = '';
$locValue = isset($arResult['ELEMENT']['LOCATION_ID']) ? $arResult['ELEMENT']['LOCATION_ID'] : '';
ob_start();
CSaleLocation::proxySaleAjaxLocationsComponent(array('AJAX_CALL' => 'N', 'COUNTRY_INPUT_NAME' => 'LOC_COUNTRY', 'REGION_INPUT_NAME' => 'LOC_REGION', 'CITY_INPUT_NAME' => 'LOC_CITY', 'CITY_OUT_LOCATION' => 'Y', 'LOCATION_VALUE' => $locValue, 'ORDER_PROPS_ID' => 'QUOTE_' . $arResult['ELEMENT']['ID'], 'ONCITYCHANGE' => 'BX.onCustomEvent(\'CrmProductRowSetLocation\', [\'LOC_CITY\']);', 'SHOW_QUICK_CHOOSE' => 'N'), array("CODE" => $locValue, "ID" => "", "PROVIDE_LINK_BY" => "code", "JS_CALLBACK" => 'CrmProductRowSetLocation'), 'popup');
$sLocationHtml = ob_get_contents();
ob_end_clean();
$locationField = array('id' => 'LOCATION_ID', 'name' => GetMessage('CRM_QUOTE_FIELD_LOCATION_ID'), 'type' => 'custom', 'value' => $sLocationHtml . '<div>' . '<span class="bx-crm-edit-content-location-description">' . GetMessage('CRM_QUOTE_FIELD_LOCATION_ID_DESCRIPTION') . '</span>' . '</div>', 'required' => true);
$arResult['FIELDS']['tab_1'][] = $locationField;
$arResult['FORM_FIELDS_TO_ADD']['LOCATION_ID'] = $locationField;
unset($locationField);
}
// Rewrite client fields
示例3: intval
// pager index
$arResult['PAGE_NUMBER'] = intval($dbRes->NavPageNomer);
// current page index
$arResult['PAGE_NAVCOUNT'] = intval($dbRes->NavPageCount);
// page count
$arResult['PAGER_PARAM'] = "PAGEN_{$arResult['PAGE_NAVNUM']}";
$arResult['PAGE_NEXT_NUMBER'] = $arResult['PAGE_NUMBER'] + 1;
$arResult['COMPANY_TYPE_LIST'] = CCrmStatus::GetStatusList('COMPANY_TYPE');
//$arResult['EMPLOYEES_LIST'] = CCrmStatus::GetStatusList('EMPLOYEES');
$arResult['INDUSTRY_LIST'] = CCrmStatus::GetStatusList('INDUSTRY');
while ($item = $dbRes->GetNext()) {
CCrmMobileHelper::PrepareCompanyItem($item, $arParams, array('COMPANY_TYPE' => $arResult['COMPANY_TYPE_LIST'], 'INDUSTRY' => $arResult['INDUSTRY_LIST']));
$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&SEARCH=' . ($enableSearch ? 'Y' : 'N') . '&' . $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.company.list/ajax.php?siteID=' . SITE_ID . '&' . bitrix_sessid_get();
$arResult['PERMISSIONS'] = array('CREATE' => CCrmCompany::CheckCreatePermission());
$arResult['CREATE_URL'] = $arParams['COMPANY_EDIT_URL_TEMPLATE'] !== '' ? CComponentEngine::MakePathFromTemplate($arParams['COMPANY_EDIT_URL_TEMPLATE'], array('company_id' => 0)) : '';
$arResult['RELOAD_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&FORMAT=json', array('AJAX_CALL', 'SEARCH', 'FORMAT', 'save', 'apply_filter', 'clear_filter'));
$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: 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;
示例6: 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);
示例7: CrmCheckPath
$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_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"]);
$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 ? CCrmCompany::CheckUpdatePermission($arParams['ELEMENT_ID'], $userPermissions) : CCrmCompany::CheckCreatePermission($userPermissions);
if (!$isPermitted) {
ShowError(GetMessage('CRM_PERMISSION_DENIED'));
return;
}
$arEntityAttr = $arParams['ELEMENT_ID'] > 0 ? $userPermissions->GetEntityAttr('COMPANY', array($arParams['ELEMENT_ID'])) : array();
$bInternal = false;
if (isset($arParams['INTERNAL_FILTER']) && !empty($arParams['INTERNAL_FILTER'])) {
$bInternal = true;
}
$arResult['INTERNAL'] = $bInternal;
if ($bEdit || $bCopy) {
$arFilter = array('ID' => $arParams['ELEMENT_ID'], 'PERMISSION' => 'WRITE');
$obFields = CCrmCompany::GetListEx(array(), $arFilter);
$arFields = $obFields->GetNext();
if ($arFields === false) {
示例8: array
$arResult['TOOLBAR_ID'] = $toolbarID;
$arResult['BUTTONS'] = array();
if ($arParams['TYPE'] == 'list') {
$bRead = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ');
$bExport = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'EXPORT');
$bImport = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'IMPORT');
$bAdd = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'ADD');
$bWrite = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'WRITE');
$bDelete = false;
$bDedupe = !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'WRITE') && !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'DELETE');
} else {
$bExport = false;
$bImport = false;
$bDedupe = false;
$bRead = CCrmCompany::CheckReadPermission($arParams['ELEMENT_ID'], $CrmPerms);
$bAdd = CCrmCompany::CheckCreatePermission($CrmPerms);
$bWrite = CCrmCompany::CheckUpdatePermission($arParams['ELEMENT_ID'], $CrmPerms);
$bDelete = CCrmCompany::CheckDeletePermission($arParams['ELEMENT_ID'], $CrmPerms);
}
if ($arParams['TYPE'] === 'list') {
if ($bAdd) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('COMPANY_ADD'), 'TITLE' => GetMessage('COMPANY_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_EDIT'], array('company_id' => 0)), 'HIGHLIGHT' => true);
}
if ($bImport) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('COMPANY_IMPORT'), 'TITLE' => GetMessage('COMPANY_IMPORT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_COMPANY_IMPORT'], array()), 'ICON' => 'btn-import');
}
if ($bExport) {
$arResult['BUTTONS'][] = array('TITLE' => GetMessage('COMPANY_EXPORT_CSV_TITLE'), 'TEXT' => GetMessage('COMPANY_EXPORT_CSV'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'csv', 'ncc' => '1')), 'ICON' => 'btn-export');
$arResult['BUTTONS'][] = array('TITLE' => GetMessage('COMPANY_EXPORT_EXCEL_TITLE'), 'TEXT' => GetMessage('COMPANY_EXPORT_EXCEL'), 'LINK' => CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($APPLICATION->GetCurPage(), array()), array('type' => 'excel', 'ncc' => '1')), 'ICON' => 'btn-export');
}
if ($bDedupe) {
示例9: innerAdd
protected function innerAdd(&$fields, &$errors, array $params = null)
{
if (!CCrmCompany::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::Company, $result, CCrmBizProcEventType::Create, $errors);
}
return $result;
}
示例10: 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;
}
示例11: 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')));
}