本文整理汇总了PHP中CCrmContact::CheckDeletePermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::CheckDeletePermission方法的具体用法?PHP CCrmContact::CheckDeletePermission怎么用?PHP CCrmContact::CheckDeletePermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCrmContact
的用法示例。
在下文中一共展示了CCrmContact::CheckDeletePermission方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEntityDeletePermission
protected function checkEntityDeletePermission($entityID, $userPermissions)
{
return \CCrmContact::CheckDeletePermission($entityID, $userPermissions);
}
示例2: 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);
}
}
}
}
//.........这里部分代码省略.........
示例3: LocalRedirect
}
LocalRedirect($redirectUrl);
} elseif (isset($_POST['saveAndView'])) {
if (CCrmContact::CheckReadPermission($ID)) {
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_SHOW'], array('contact_id' => $ID)));
}
}
//save
LocalRedirect(isset($_REQUEST['backurl']) && $_REQUEST['backurl'] !== '' ? $_REQUEST['backurl'] : CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_LIST'], array()));
}
}
} else {
if (isset($_GET['delete']) && check_bitrix_sessid()) {
if ($isEditMode) {
$arResult['ERROR_MESSAGE'] = '';
if (!CCrmContact::CheckDeletePermission($arParams['ELEMENT_ID'], $userPermissions)) {
$arResult['ERROR_MESSAGE'] .= GetMessage('CRM_PERMISSION_DENIED') . '<br />';
}
$bDeleteError = !$CCrmBizProc->Delete($arResult['ELEMENT']['ID'], $arEntityAttr[$arParams['ELEMENT_ID']]);
if ($bDeleteError) {
$arResult['ERROR_MESSAGE'] .= $CCrmBizProc->LAST_ERROR;
}
if (empty($arResult['ERROR_MESSAGE']) && !$CCrmContact->Delete($arResult['ELEMENT']['ID'], array('PROCESS_BIZPROC' => false))) {
$arResult['ERROR_MESSAGE'] = GetMessage('CRM_DELETE_ERROR');
}
if (empty($arResult['ERROR_MESSAGE'])) {
LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_LIST']));
} else {
ShowError($arResult['ERROR_MESSAGE']);
return;
}
示例4: __CrmMobileContactEditEndResonse
} else {
//$DB->Rollback();
__CrmMobileContactEditEndResonse(array('ERROR' => strip_tags(preg_replace("/<br[^>]*>/", "\n", $fields['RESULT_MESSAGE']))));
}
}
} elseif ($action === 'DELETE_ENTITY') {
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
$typeName = isset($_REQUEST['ENTITY_TYPE_NAME']) ? $_REQUEST['ENTITY_TYPE_NAME'] : '';
if ($typeName !== 'CONTACT') {
__CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_TYPE_NOT_SUPPORTED', array('#ENTITY_TYPE#' => $typeName))));
}
$ID = isset($_REQUEST['ENTITY_ID']) ? intval($_REQUEST['ENTITY_ID']) : 0;
if ($ID <= 0) {
__CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_ID_NOT_FOUND')));
}
if (!CCrmContact::CheckDeletePermission($ID)) {
__CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
}
$entity = new CCrmContact(false);
//$DB->StartTransaction();
$successed = $entity->Delete($ID);
if ($successed) {
//$DB->Commit();
__CrmMobileContactEditEndResonse(array('DELETED_ENTITY_ID' => $ID));
} else {
//$DB->Rollback();
__CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_CONTACT_COULD_NOT_DELETE')));
}
} elseif ($action === 'GET_ENTITY') {
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
$typeName = isset($_REQUEST['ENTITY_TYPE_NAME']) ? $_REQUEST['ENTITY_TYPE_NAME'] : '';
示例5: intval
$arResult['USER_ID'] = intval(CCrmSecurityHelper::GetCurrentUserID());
$arParams['UID'] = isset($arParams['UID']) ? $arParams['UID'] : '';
if (!isset($arParams['UID']) || $arParams['UID'] === '') {
$arParams['UID'] = 'mobile_crm_contact_view';
}
$arResult['UID'] = $arParams['UID'];
$serviceURLTemplate = $arParams["SERVICE_URL_TEMPLATE"] ? $arParams["SERVICE_URL_TEMPLATE"] : '#SITE_DIR#bitrix/components/bitrix/mobile.crm.contact.edit/ajax.php?site_id=#SITE#&sessid=#SID#';
$arResult['SERVICE_URL'] = CComponentEngine::makePathFromTemplate($serviceURLTemplate, array('SID' => bitrix_sessid()));
$dbFields = CCrmContact::GetListEx(array(), array('ID' => $entityID));
$arFields = $dbFields->GetNext();
if (!$arFields) {
ShowError(GetMessage('CRM_CONTACT_VIEW_NOT_FOUND', array('#ID#' => $arParams['ENTITY_ID'])));
return;
}
//Permissions -->
$arResult['PERMISSIONS'] = array('EDIT' => CCrmContact::CheckUpdatePermission($entityID, $userPerms), 'DELETE' => CCrmContact::CheckDeletePermission($entityID, $userPerms));
//<-- Permissions
$arFields['~NAME'] = isset($arFields['~NAME']) ? $arFields['~NAME'] : '';
$arFields['~LAST_NAME'] = isset($arFields['~LAST_NAME']) ? $arFields['~LAST_NAME'] : '';
$arFields['~SECOND_NAME'] = isset($arFields['~SECOND_NAME']) ? $arFields['~SECOND_NAME'] : '';
$arFields['~POST'] = isset($arFields['~POST']) ? $arFields['~POST'] : '';
$arFields['~PHOTO'] = isset($arFields['~PHOTO']) ? intval($arFields['~PHOTO']) : 0;
$arFields['~COMPANY_ID'] = isset($arFields['~COMPANY_ID']) ? intval($arFields['~COMPANY_ID']) : 0;
$arFields['~COMPANY_TITLE'] = isset($arFields['~COMPANY_TITLE']) ? $arFields['~COMPANY_TITLE'] : '';
$arFields['~ASSIGNED_BY_ID'] = isset($arFields['~ASSIGNED_BY_ID']) ? intval($arFields['~ASSIGNED_BY_ID']) : 0;
$arFields['~ASSIGNED_BY_LOGIN'] = isset($arFields['~ASSIGNED_BY_LOGIN']) ? $arFields['~ASSIGNED_BY_LOGIN'] : '';
$arFields['~ASSIGNED_BY_NAME'] = isset($arFields['~ASSIGNED_BY_NAME']) ? $arFields['~ASSIGNED_BY_NAME'] : '';
$arFields['~ASSIGNED_BY_LAST_NAME'] = isset($arFields['~ASSIGNED_BY_LAST_NAME']) ? $arFields['~ASSIGNED_BY_LAST_NAME'] : '';
$arFields['~ASSIGNED_BY_SECOND_NAME'] = isset($arFields['~ASSIGNED_BY_SECOND_NAME']) ? $arFields['~ASSIGNED_BY_SECOND_NAME'] : '';
$arFields['~TYPE_ID'] = isset($arFields['~TYPE_ID']) ? $arFields['~TYPE_ID'] : '';
$arFields['~ADDRESS'] = isset($arFields['~ADDRESS']) ? $arFields['~ADDRESS'] : '';
示例6: array
if ($arParams['TYPE'] == 'list') {
$bRead = !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ');
$bExport = !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'EXPORT');
$bImport = !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'IMPORT');
$bAdd = !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'ADD');
$bWrite = !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'WRITE');
$bDelete = false;
$bDedupe = !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'WRITE') && !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'DELETE');
} else {
$bExport = false;
$bImport = false;
$bDedupe = false;
$bRead = CCrmContact::CheckReadPermission($arParams['ELEMENT_ID'], $CrmPerms);
$bAdd = CCrmContact::CheckCreatePermission($CrmPerms);
$bWrite = CCrmContact::CheckUpdatePermission($arParams['ELEMENT_ID'], $CrmPerms);
$bDelete = CCrmContact::CheckDeletePermission($arParams['ELEMENT_ID'], $CrmPerms);
}
if (!$bRead && !$bAdd && !$bWrite) {
return false;
}
if ($arParams['TYPE'] === 'list') {
if ($bAdd) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_CONTACT_ADD'), 'TITLE' => GetMessage('CRM_CONTACT_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => 0)), 'HIGHLIGHT' => true);
}
if ($bImport) {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_CONTACT_IMPORT_VCARD'), 'TITLE' => GetMessage('CRM_CONTACT_IMPORT_VCARD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_IMPORTVCARD'], array()), 'ICON' => 'btn-import');
$importUrl = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_IMPORT'], array());
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_CONTACT_IMPORT_GMAIL'), 'TITLE' => GetMessage('CRM_CONTACT_IMPORT_GMAIL_TITLE'), 'LINK' => CCrmUrlUtil::AddUrlParams($importUrl, array('origin' => 'gmail')), 'ICON' => 'btn-import');
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_CONTACT_IMPORT_OUTLOOK'), 'TITLE' => GetMessage('CRM_CONTACT_IMPORT_OUTLOOK_TITLE'), 'LINK' => CCrmUrlUtil::AddUrlParams($importUrl, array('origin' => 'outlook')), 'ICON' => 'btn-import');
if (LANGUAGE_ID === 'ru' || LANGUAGE_ID === 'ua') {
$arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_CONTACT_IMPORT_YANDEX'), 'TITLE' => GetMessage('CRM_CONTACT_IMPORT_YANDEX_TITLE'), 'LINK' => CCrmUrlUtil::AddUrlParams($importUrl, array('origin' => 'yandex')), 'ICON' => 'btn-import');
示例7: innerDelete
protected function innerDelete($ID, &$errors)
{
if (!CCrmContact::CheckDeletePermission($ID)) {
$errors[] = 'Access denied.';
return false;
}
$entity = self::getEntity();
$result = $entity->Delete($ID);
if ($result !== true) {
$errors[] = $entity->LAST_ERROR;
}
return $result;
}