当前位置: 首页>>代码示例>>PHP>>正文


PHP CCrmContact::CheckUpdatePermission方法代码示例

本文整理汇总了PHP中CCrmContact::CheckUpdatePermission方法的典型用法代码示例。如果您正苦于以下问题:PHP CCrmContact::CheckUpdatePermission方法的具体用法?PHP CCrmContact::CheckUpdatePermission怎么用?PHP CCrmContact::CheckUpdatePermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCrmContact的用法示例。


在下文中一共展示了CCrmContact::CheckUpdatePermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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);
                         }
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:101,代码来源:duplicateentityranking.php

示例2: __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 ? 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);
            __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';
开发者ID:pitnan,项目名称:u136056,代码行数:31,代码来源:file.php

示例3: while

// page count
$arResult['PAGER_PARAM'] = "PAGEN_{$arResult['PAGE_NAVNUM']}";
$arResult['PAGE_NEXT_NUMBER'] = $arResult['PAGE_NUMBER'] + 1;
while ($item = $dbRes->Fetch()) {
    $itemID = intval($item['ID']);
    $ownerID = intval($item['OWNER_ID']);
    $ownerTypeID = intval($item['OWNER_TYPE_ID']);
    CCrmMobileHelper::PrepareActivityItem($item, $arParams, array('ENABLE_COMMUNICATIONS' => false));
    $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&' . $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.activity.list/ajax.php?siteID=' . SITE_ID . '&' . bitrix_sessid_get();
$arResult['IS_FILTERED'] = !empty($filter);
$arResult['CREATE_CALL_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Call)) : '';
$arResult['CREATE_MEETING_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Meeting)) : '';
$arResult['CREATE_EMAIL_URL'] = $arParams['ACTIVITY_CREATE_URL_TEMPLATE'] !== '' ? CComponentEngine::makePathFromTemplate($arParams['ACTIVITY_CREATE_URL_TEMPLATE'], array('owner_type' => $entityTypeName, 'owner_id' => $entityID, 'type_id' => CCrmActivityType::Email)) : '';
$arResult['RELOAD_URL'] = $APPLICATION->GetCurPageParam('AJAX_CALL=Y&FORMAT=json', array('AJAX_CALL', 'SEARCH', 'FORMAT', 'save', 'apply_filter', 'clear_filter'));
//Require any update permission
$arResult['PERMISSIONS'] = array('CREATE' => CCrmLead::CheckUpdatePermission(0, $userPerms) || CCrmCompany::CheckUpdatePermission(0, $userPerms) || CCrmContact::CheckUpdatePermission(0, $userPerms) || CCrmDeal::CheckUpdatePermission(0, $userPerms));
$format = isset($_REQUEST['FORMAT']) ? strtolower($_REQUEST['FORMAT']) : '';
// Only JSON format is supported
if ($format !== '' && $format !== 'json') {
    $format = '';
}
$this->IncludeComponentTemplate($format);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例4: checkEntityUpdatePermission

 protected function checkEntityUpdatePermission($entityID, $userPermissions)
 {
     return \CCrmContact::CheckUpdatePermission($entityID, $userPermissions);
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:4,代码来源:contactmerger.php

示例5: 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 '';
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:44,代码来源:crm_owner_type.php

示例6: isset

 }
 $ID = isset($arResult['ELEMENT']['ID']) ? $arResult['ELEMENT']['ID'] : 0;
 if (!empty($arResult['ERROR_MESSAGE'])) {
     ShowError($arResult['ERROR_MESSAGE']);
     $arResult['ELEMENT'] = CCrmComponentHelper::PrepareEntityFields(array_merge(array('ID' => $ID), $arFields), CCrmContact::GetFields());
 } else {
     if (!isset($_POST['COMPANY_ID']) && isset($_POST['COMPANY_NAME'])) {
         if (CCrmCompany::CheckCreatePermission()) {
             $arFields = array('TITLE' => trim($_POST['COMPANY_NAME']), 'CONTACT_ID' => array($ID));
             $CCrmCompany = new CCrmCompany();
             $companyId = $CCrmCompany->Add($arFields);
             $CCrmContact->UpdateCompanyId($ID, $companyId);
         }
     }
     if (isset($_POST['apply'])) {
         if (CCrmContact::CheckUpdatePermission($ID)) {
             LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => $ID)));
         }
     } elseif (isset($_POST['saveAndAdd'])) {
         $redirectUrl = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_CONTACT_EDIT'], array('contact_id' => 0));
         if ($companyID > 0) {
             $redirectUrl = CCrmUrlUtil::AddUrlParams($redirectUrl, array('company_id' => $companyID));
         }
         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()));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例7: serialize

     }
     if ($itemQty > 0) {
         CCrmCompany::RebuildEntityAccessAttrs($itemIDs);
         $progressData['TOTAL_ITEMS'] = $totalItemQty;
         $processedItemQty += $itemQty;
         $progressData['PROCESSED_ITEMS'] = $processedItemQty;
         $progressData['LAST_ITEM_ID'] = $itemIDs[$itemQty - 1];
         COption::SetOptionString('crm', '~CRM_REBUILD_COMPANY_ATTR_PROGRESS', serialize($progressData));
         __CrmConfigPermsEndResonse(array('STATUS' => 'PROGRESS', 'PROCESSED_ITEMS' => $processedItemQty, 'TOTAL_ITEMS' => $totalItemQty, 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_PROGRESS_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty, '#TOTAL_ITEMS#' => $totalItemQty))));
     } else {
         COption::RemoveOption('crm', '~CRM_REBUILD_COMPANY_ATTR');
         COption::RemoveOption('crm', '~CRM_REBUILD_COMPANY_ATTR_PROGRESS');
         __CrmConfigPermsEndResonse(array('STATUS' => 'COMPLETED', 'PROCESSED_ITEMS' => $processedItemQty, 'TOTAL_ITEMS' => $totalItemQty, 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_COMPLETED_SUMMARY', array('#PROCESSED_ITEMS#' => $processedItemQty))));
     }
 } elseif ($entityTypeID === CCrmOwnerType::Contact) {
     if (!CCrmContact::CheckUpdatePermission(0)) {
         __CrmConfigPermsEndResonse(array('ERROR' => 'Access denied.'));
     }
     if (COption::GetOptionString('crm', '~CRM_REBUILD_CONTACT_ATTR', 'N') !== 'Y') {
         __CrmConfigPermsEndResonse(array('STATUS' => 'NOT_REQUIRED', 'SUMMARY' => GetMessage('CRM_CONFIG_PERMS_REBUILD_ATTR_NOT_REQUIRED_SUMMARY')));
     }
     $progressData = COption::GetOptionString('crm', '~CRM_REBUILD_CONTACT_ATTR_PROGRESS', '');
     $progressData = $progressData !== '' ? unserialize($progressData) : array();
     $lastItemID = isset($progressData['LAST_ITEM_ID']) ? intval($progressData['LAST_ITEM_ID']) : 0;
     $processedItemQty = isset($progressData['PROCESSED_ITEMS']) ? intval($progressData['PROCESSED_ITEMS']) : 0;
     $totalItemQty = isset($progressData['TOTAL_ITEMS']) ? intval($progressData['TOTAL_ITEMS']) : 0;
     if ($totalItemQty <= 0) {
         $totalItemQty = CCrmContact::GetListEx(array(), array('CHECK_PERMISSIONS' => 'N'), array(), false);
     }
     $filter = array('CHECK_PERMISSIONS' => 'N');
     if ($lastItemID > 0) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例8: ShowError

    ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED'));
    return;
}
// 'Fileman' module always installed
CModule::IncludeModule('fileman');
$CCrmContact = new CCrmContact();
if ($CCrmContact->cPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
use Bitrix\Crm\Format\ContactAddressFormatter;
use Bitrix\Crm\Format\AddressSeparator;
CUtil::InitJSCore(array('ajax', 'tooltip'));
$arResult['EDITABLE_FIELDS'] = array();
$arResult['ELEMENT_ID'] = $arParams['ELEMENT_ID'] = isset($arParams['ELEMENT_ID']) ? intval($arParams['ELEMENT_ID']) : 0;
$arResult['CAN_EDIT'] = CCrmContact::CheckUpdatePermission($arResult['ELEMENT_ID'], $CCrmContact->cPerms);
$arParams['PATH_TO_CONTACT_LIST'] = CrmCheckPath('PATH_TO_CONTACT_LIST', $arParams['PATH_TO_CONTACT_LIST'], $APPLICATION->GetCurPage());
$arResult['PATH_TO_CONTACT_SHOW'] = $arParams['PATH_TO_CONTACT_SHOW'] = CrmCheckPath('PATH_TO_CONTACT_SHOW', $arParams['PATH_TO_CONTACT_SHOW'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&show');
$arParams['PATH_TO_CONTACT_EDIT'] = CrmCheckPath('PATH_TO_CONTACT_EDIT', $arParams['PATH_TO_CONTACT_EDIT'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&edit');
$arParams['PATH_TO_LEAD_SHOW'] = CrmCheckPath('PATH_TO_LEAD_SHOW', $arParams['PATH_TO_LEAD_SHOW'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&show');
$arParams['PATH_TO_LEAD_EDIT'] = CrmCheckPath('PATH_TO_LEAD_EDIT', $arParams['PATH_TO_LEAD_EDIT'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&edit');
$arParams['PATH_TO_LEAD_CONVERT'] = CrmCheckPath('PATH_TO_LEAD_CONVERT', $arParams['PATH_TO_LEAD_CONVERT'], $APPLICATION->GetCurPage() . '?lead_id=#lead_id#&convert');
$arParams['PATH_TO_COMPANY_SHOW'] = CrmCheckPath('PATH_TO_COMPANY_SHOW', $arParams['PATH_TO_COMPANY_SHOW'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&show');
$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_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_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"]);
global $USER_FIELD_MANAGER;
$CCrmUserType = new CCrmUserType($USER_FIELD_MANAGER, CCrmContact::$sUFEntityID);
$bEdit = false;
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例9: 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 !== 'CONTACT') {
        __CrmMobileContactEditEndResonse(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) {
        __CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_ENTITY_DATA_NOT_FOUND')));
    }
    $ID = isset($data['ID']) ? intval($data['ID']) : 0;
    $isNew = $ID <= 0;
    $hasPermission = $isNew ? CCrmContact::CheckCreatePermission() : CCrmContact::CheckUpdatePermission($ID);
    if (!$hasPermission) {
        __CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_ACCESS_DENIED')));
    }
    $currentItem = null;
    if (!$isNew) {
        $dbRes = CCrmContact::GetListEx(array(), array('=ID' => $ID, 'CHECK_PERMISSIONS' => 'N'));
        $currentItem = $dbRes->GetNext();
        if (!is_array($currentItem)) {
            __CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_CONTACT_NOT_FOUND', array('#ID#' => $ID))));
        }
    }
    $name = isset($data['NAME']) ? $data['NAME'] : '';
    $lastName = isset($data['LAST_NAME']) ? $data['LAST_NAME'] : '';
    if ($name === '' && $lastName === '') {
        __CrmMobileContactEditEndResonse(array('ERROR' => GetMessage('CRM_CONTACT_NAME_NOT_ASSIGNED')));
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例10: array

$arResult['BUTTONS'] = 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') {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例11: 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'] : '';
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php

示例12: innerUpdate

 protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
 {
     if (!CCrmContact::CheckUpdatePermission($ID)) {
         $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->Update($ID, $fields, true, true, $options);
     if ($result !== true) {
         $errors[] = $entity->LAST_ERROR;
     } elseif (self::isBizProcEnabled()) {
         CCrmBizProcHelper::AutoStartWorkflows(CCrmOwnerType::Contact, $ID, CCrmBizProcEventType::Edit, $errors);
     }
     return $result;
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:22,代码来源:restservice.php

示例13: IncludeModuleLangFile

<?php

require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php";
global $APPLICATION;
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/stream/index.php");
$APPLICATION->SetTitle(GetMessage("CRM_TITLE"));
$APPLICATION->SetPageProperty("BodyClass", " page-one-column");
if (CModule::IncludeModule("crm") && CCrmPerms::IsAccessEnabled()) {
    $currentUserPerms = CCrmPerms::GetCurrentUserPermissions();
    $canEdit = CCrmLead::CheckUpdatePermission(0, $currentUserPerms) || CCrmContact::CheckUpdatePermission(0, $currentUserPerms) || CCrmCompany::CheckUpdatePermission(0, $currentUserPerms) || CCrmDeal::CheckUpdatePermission(0, $currentUserPerms);
    $APPLICATION->IncludeComponent("bitrix:crm.control_panel", "", array("ID" => "STREAM", "ACTIVE_ITEM_ID" => "STREAM", "PATH_TO_COMPANY_LIST" => "/crm/company/", "PATH_TO_COMPANY_EDIT" => "/crm/company/edit/#company_id#/", "PATH_TO_CONTACT_LIST" => "/crm/contact/", "PATH_TO_CONTACT_EDIT" => "/crm/contact/edit/#contact_id#/", "PATH_TO_DEAL_LIST" => "/crm/deal/", "PATH_TO_DEAL_EDIT" => "/crm/deal/edit/#deal_id#/", "PATH_TO_QUOTE_LIST" => "/crm/quote/", "PATH_TO_QUOTE_EDIT" => "/crm/quote/edit/#quote_id#/", "PATH_TO_INVOICE_LIST" => "/crm/invoice/", "PATH_TO_INVOICE_EDIT" => "/crm/invoice/edit/#invoice_id#/", "PATH_TO_LEAD_LIST" => "/crm/lead/", "PATH_TO_LEAD_EDIT" => "/crm/lead/edit/#lead_id#/", "PATH_TO_REPORT_LIST" => "/crm/reports/report/", "PATH_TO_DEAL_FUNNEL" => "/crm/reports/", "PATH_TO_EVENT_LIST" => "/crm/events/", "PATH_TO_PRODUCT_LIST" => "/crm/product/", "PATH_TO_SETTINGS" => "/crm/configs/", "PATH_TO_SEARCH_PAGE" => "/search/index.php?where=crm"));
    // --> IMPORT RESPONSIBILITY SUBSCRIPTIONS
    $currentUserID = CCrmSecurityHelper::GetCurrentUserID();
    if ($currentUserID > 0) {
        CCrmSonetSubscription::EnsureAllResponsibilityImported($currentUserID);
    }
    // <-- IMPORT RESPONSIBILITY SUBSCRIPTIONS
    $APPLICATION->IncludeComponent("bitrix:crm.entity.livefeed", "", array("DATE_TIME_FORMAT" => "d.m.Y H:i:s", "CAN_EDIT" => $canEdit, "FORM_ID" => "", "PATH_TO_USER_PROFILE" => "/company/personal/user/#user_id#/", "PATH_TO_GROUP" => "/workgroups/group/#group_id#/", "PATH_TO_CONPANY_DEPARTMENT" => "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#"), null, array("HIDE_ICONS" => "Y"));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php";
开发者ID:pitnan,项目名称:u136056,代码行数:20,代码来源:index.php

示例14: Header

    $GLOBALS['APPLICATION']->RestartBuffer();
    Header('Content-Type: text/html; charset=' . LANG_CHARSET);
    $emailEditor = new CLightHTMLEditor();
    $emailEditor->Show(array('id' => $lheEditorID, 'height' => '250', 'BBCode' => false, 'bUseFileDialogs' => false, 'bFloatingToolbar' => false, 'bArisingToolbar' => false, 'bResizable' => false, 'autoResizeOffset' => 20, 'jsObjName' => $lheEditorName, 'bInitByJS' => false, 'bSaveOnBlur' => false, 'toolbarConfig' => array('Bold', 'Italic', 'Underline', 'Strike', 'BackColor', 'ForeColor', 'CreateLink', 'DeleteLink', 'InsertOrderedList', 'InsertUnorderedList', 'Outdent', 'Indent')));
    __CrmContactShowEndHtmlResonse();
}
$type = isset($_POST['OWNER_TYPE']) ? strtoupper($_POST['OWNER_TYPE']) : '';
if ($type !== 'C') {
    __CrmContactShowEndJsonResonse(array('ERROR' => 'OWNER_TYPE IS NOT SUPPORTED!'));
}
if ($mode === 'UPDATE') {
    $ID = isset($_POST['OWNER_ID']) ? $_POST['OWNER_ID'] : 0;
    if ($ID <= 0) {
        __CrmContactShowEndJsonResonse(array('ERROR' => 'ID IS INVALID OR NOT DEFINED!'));
    }
    if (!CCrmContact::CheckUpdatePermission($ID, $currentUserPermissions)) {
        __CrmContactShowEndJsonResonse(array('ERROR' => 'PERMISSION DENIED!'));
    }
    $fieldNames = array();
    $hasUserFields = false;
    if (isset($_POST['FIELD_NAME'])) {
        if (is_array($_POST['FIELD_NAME'])) {
            $fieldNames = $_POST['FIELD_NAME'];
            foreach ($fieldNames as $fieldName) {
                if (strncmp($fieldName, 'UF_', 3) === 0) {
                    $hasUserFields = true;
                    break;
                }
            }
        } else {
            $fieldNames[] = $_POST['FIELD_NAME'];
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:ajax.php

示例15: 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['contact_id'])) {
    $entityID = $arParams['ENTITY_ID'] = intval($_GET['contact_id']);
}
$arResult['ENTITY_ID'] = $entityID;
$userPerms = CCrmPerms::GetCurrentUserPermissions();
if (!($entityID > 0 ? CCrmContact::CheckUpdatePermission($entityID, $userPerms) : CCrmContact::CheckCreatePermission($userPerms))) {
    ShowError(GetMessage('CRM_PERMISSION_DENIED'));
    return;
}
global $APPLICATION;
//$arParams['ACTIVITY_LIST_URL_TEMPLATE'] = isset($arParams['ACTIVITY_LIST_URL_TEMPLATE']) ? $arParams['ACTIVITY_LIST_URL_TEMPLATE'] : '';
//$arParams['COMMUNICATION_LIST_URL_TEMPLATE'] = isset($arParams['COMMUNICATION_LIST_URL_TEMPLATE']) ? $arParams['COMMUNICATION_LIST_URL_TEMPLATE'] : '';
//$arParams['EVENT_LIST_URL_TEMPLATE'] = isset($arParams['EVENT_LIST_URL_TEMPLATE']) ? $arParams['EVENT_LIST_URL_TEMPLATE'] : '';
//$arParams['DEAL_LIST_URL_TEMPLATE'] = isset($arParams['DEAL_LIST_URL_TEMPLATE']) ? $arParams['DEAL_LIST_URL_TEMPLATE'] : '';
//$arParams['USER_PROFILE_URL_TEMPLATE'] = isset($arParams['USER_PROFILE_URL_TEMPLATE']) ? $arParams['USER_PROFILE_URL_TEMPLATE'] : '';
$arParams['CONTACT_SHOW_URL_TEMPLATE'] = isset($arParams['CONTACT_SHOW_URL_TEMPLATE']) ? $arParams['CONTACT_SHOW_URL_TEMPLATE'] : '';
$arParams['CONTACT_EDIT_URL_TEMPLATE'] = isset($arParams['CONTACT_EDIT_URL_TEMPLATE']) ? $arParams['CONTACT_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['COMPANY_SELECTOR_URL_TEMPLATE'] = isset($arParams['COMPANY_SELECTOR_URL_TEMPLATE']) ? $arParams['COMPANY_SELECTOR_URL_TEMPLATE'] : '';
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array('#NOBR#', '#/NOBR#'), array('', ''), $arParams['NAME_TEMPLATE']);
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:component.php


注:本文中的CCrmContact::CheckUpdatePermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。