/** * Function checks if user have basic permissions to launch the component * @throws Exception * @return void */ protected function checkPermissions() { $result = true; $CrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ')) { $this->errors['FATAL'][] = Loc::getMessage('CRM_CLL2_PERMISSION_DENIED'); $result = false; } else { $this->dbResult['CAN_DELETE'] = $this->dbResult['CAN_EDIT'] = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); } return $result; }
public static function CheckAuth() { $CCrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); if ($CCrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE)) { return new CSOAPFault('Server Error', 'Unable to authorize user.'); } return false; }
protected static function checkAccessPermissions($parameters = array()) { if (!is_array($parameters)) { $parameters = array(); } $errors = array(); $CCrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); if ($CCrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE, 'WRITE')) { $errors[] = Loc::getMessage("SALE_CCLI2_CRM_MODULE_WRITE_ACCESS_DENIED"); } if (!LocationHelper::checkLocationEnabled()) { $errors[] = 'Locations were disabled or data has not been converted'; } if ($parameters['CHECK_CSRF']) { $post = \Bitrix\Main\Context::getCurrent()->getRequest()->getPostList(); if (!strlen($post['csrf']) || bitrix_sessid() != $post['csrf']) { $errors[] = 'CSRF token is not valid'; } } return $errors; }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/reports/.left.menu_ext.php"); $aMenuLinksExt = array(); if (CModule::IncludeModule('crm') && CModule::IncludeModule('report')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_REPORT_LIST"), "#SITE_DIR#crm/reports/report/", array(), array(), ""); $CrmPerms = new CCrmPerms($GLOBALS["USER"]->GetID()); if (!$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE, 'READ')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_FUNNEL"), "#SITE_DIR#crm/reports/index.php", array(), array(), ""); } $obRep = CReport::GetList('crm'); while ($arRep = $obRep->fetch()) { $aMenuLinksExt[] = array($arRep['TITLE'], CComponentEngine::MakePathFromTemplate("#SITE_DIR#crm/reports/report/view/#report_id#/", array('report_id' => $arRep['ID'])), array(), array(), ""); } } $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt);
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule('crm')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED')); return; } if (!CModule::IncludeModule('sale')) { ShowError(GetMessage('CRM_SALE_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $CrmPerms = new CCrmPerms($USER->GetID()); if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ')) { ShowError(GetMessage('CRM_PERMISSION_DENIED')); return; } $arResult['CAN_DELETE'] = $arResult['CAN_EDIT'] = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); $arParams['PATH_TO_TAX_LIST'] = CrmCheckPath('PATH_TO_TAX_LIST', $arParams['PATH_TO_TAX_LIST'], ''); $arParams['PATH_TO_TAX_SHOW'] = CrmCheckPath('PATH_TO_TAX_SHOW', $arParams['PATH_TO_TAX_SHOW'], '?tax_id=#tax_id#&show'); $arParams['PATH_TO_TAX_ADD'] = CrmCheckPath('PATH_TO_TAX_ADD', $arParams['PATH_TO_TAX_ADD'], '?add'); $arParams['PATH_TO_TAX_EDIT'] = CrmCheckPath('PATH_TO_TAX_EDIT', $arParams['PATH_TO_TAX_EDIT'], '?tax_id=#tax_id#&edit'); $arResult['GRID_ID'] = 'CRM_TAX_LIST'; $arResult['FORM_ID'] = isset($arParams['FORM_ID']) ? $arParams['FORM_ID'] : ''; $arResult['EDIT_FORM_ID'] = 'CRM_TAX_EDIT_FORM'; $arResult['TAB_ID'] = isset($arParams['TAB_ID']) ? $arParams['TAB_ID'] : ''; $arResult['HEADERS'] = array(array('id' => 'ID', 'name' => GetMessage('CRM_COLUMN_ID'), 'sort' => 'ID', 'default' => false, 'editable' => false), array('id' => 'NAME', 'name' => GetMessage('CRM_COLUMN_NAME'), 'sort' => 'NAME', 'default' => true, 'editable' => true), array('id' => 'STAV', 'name' => GetMessage('CRM_COLUMN_RATES'), 'sort' => false, 'default' => true, 'editable' => false), array('id' => 'TIMESTAMP_X', 'name' => GetMessage('CRM_COLUMN_DATE'), 'sort' => 'TIMESTAMP_X', 'default' => true, 'editable' => false), array('id' => 'LID', 'name' => GetMessage('CRM_COLUMN_SITE'), 'sort' => false, 'default' => false, 'editable' => false), array('id' => 'CODE', 'name' => GetMessage('CRM_COLUMN_CODE'), 'sort' => 'CODE', 'default' => false, 'editable' => true)); if ($_SERVER['REQUEST_METHOD'] === 'POST' && check_bitrix_sessid() && isset($_POST['action_button_' . $arResult['GRID_ID']])) { $action = $_POST['action_button_' . $arResult['GRID_ID']];
} if (!CModule::IncludeModule('currency')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED_CURRENCY')); return; } if (!CModule::IncludeModule('sale')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED_SALE')); return; } if (!CModule::IncludeModule('catalog')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED_CATALOG')); return; } global $APPLICATION, $USER; $CrmPerms = new CCrmPerms($USER->GetID()); if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE')) { ShowError(GetMessage('CRM_PERMISSION_DENIED')); return; } $arResult['PATH_TO_CONFIGS_INDEX'] = isset($arParams['PATH_TO_CONFIGS_INDEX']) ? $arParams['PATH_TO_CONFIGS_INDEX'] : '/crm/configs/'; $componentPage = ''; $arDefaultUrlTemplates404 = array('index' => '', 'catalog' => 'catalog/', 'invoice' => 'invoice/'); if ($arParams['SEF_MODE'] === 'Y') { $arDefaultVariableAliases404 = array(); $arComponentVariables = array(); $arVariables = array(); $arUrlTemplates = CComponentEngine::MakeComponentUrlTemplates($arDefaultUrlTemplates404, $arParams['SEF_URL_TEMPLATES']); $arVariableAliases = CComponentEngine::MakeComponentVariableAliases($arDefaultVariableAliases404, $arParams['VARIABLE_ALIASES']); $componentPage = CComponentEngine::ParseComponentPath($arParams['SEF_FOLDER'], $arUrlTemplates, $arVariables); if (!(is_string($componentPage) && isset($componentPage[0]) && isset($arDefaultUrlTemplates404[$componentPage])) || $this->__templateName === 'free') { $componentPage = 'index';
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/contact/.left.menu_ext.php"); if (CModule::IncludeModule('crm')) { $CrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); $aMenuLinksExt = array(); if (!$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'ADD')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_ADD_CONTACT"), '#SITE_DIR#crm/contact/edit/0/', array(), array(), ''); } if (!$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_CONTACT_LIST"), '#SITE_DIR#crm/contact/list/', array(), array(), ''); } if (!$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'ADD')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_CONTACT_IMPORT"), '#SITE_DIR#crm/contact/import/', array(), array(), ''); } $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt); }
} if (!CModule::IncludeModule('iblock')) { ShowError(GetMessage('CRM_IBLOCK_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $arParams['PATH_TO_PRODUCTPROPS_LIST'] = CrmCheckPath('PATH_TO_PRODUCTPROPS_LIST', $arParams['PATH_TO_PRODUCTPROPS_LIST'], ''); $arParams['PATH_TO_PRODUCTPROPS_ADD'] = CrmCheckPath('PATH_TO_PRODUCTPROPS_ADD', $arParams['PATH_TO_PRODUCTPROPS_ADD'], '?add'); $arParams['PATH_TO_PRODUCTPROPS_EDIT'] = CrmCheckPath('PATH_TO_PRODUCTPROPS_EDIT', $arParams['PATH_TO_PRODUCTPROPS_EDIT'], '?prop_id=#prop_id#&edit'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $propID = isset($arParams['PROP_ID']) ? intval($arParams['PROP_ID']) : 0; $CrmPerms = new CCrmPerms($USER->GetID()); $propAdd = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); $arProp = null; if ($propID > 0) { $iblockID = intval(CCrmCatalog::EnsureDefaultExists()); $dbRes = CIBlockProperty::GetByID($propID, $iblockID); if (is_object($dbRes)) { $arProp = $dbRes->Fetch(); } unset($dbRes); } $exists = intval($propID > 0) && is_array($arProp); if ($arParams['TYPE'] !== 'list') { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PRODUCTPROP_LIST'), 'TITLE' => GetMessage('CRM_PRODUCTPROP_LIST_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_LIST'], array()), 'ICON' => 'btn-list'); } if ($arParams['TYPE'] === 'list' && $propAdd) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PRODUCTPROP_ADD'), 'TITLE' => GetMessage('CRM_PRODUCTPROP_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PRODUCTPROPS_ADD'], array()), 'ICON' => 'btn-new');
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/company/.left.menu_ext.php"); if (CModule::IncludeModule('crm')) { $CrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); $aMenuLinksExt = array(); if (!$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'ADD')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_COMPANY_ADD"), '/crm/company/edit/0/', array(), array(), ''); } if (!$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_COMPANY_LIST"), '/crm/company/list/', array(), array(), ''); } if (!$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'ADD')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_COMPANY_IMPORT"), '/crm/company/import/', array(), array(), ''); } $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt); }
} if (!CModule::IncludeModule('crm')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED')); return; } if (!CModule::IncludeModule('sale')) { ShowError(GetMessage('CRM_SALE_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $arParams['PATH_TO_PS_LIST'] = CrmCheckPath('PATH_TO_PS_LIST', $arParams['PATH_TO_PS_LIST'], ''); $arParams['PATH_TO_PS_ADD'] = CrmCheckPath('PATH_TO_PS_ADD', $arParams['PATH_TO_PS_ADD'], '?add'); $arParams['PATH_TO_PS_EDIT'] = CrmCheckPath('PATH_TO_PS_EDIT', $arParams['PATH_TO_PS_EDIT'], '?ps_id=#ps_id#&edit'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $psID = isset($arParams['PS_ID']) ? strval($arParams['PS_ID']) : ''; $CrmPerms = new CCrmPerms($USER->GetID()); $psAdd = $psEdit = $psDelete = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); $exists = intval($psID > 0) && is_array(CSalePaySystem::GetList(array(), array('ID' => $psID), false, false, array('ID'))); if ($arParams['TYPE'] !== 'list') { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PS_LIST'), 'TITLE' => GetMessage('CRM_PS_LIST_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PS_LIST'], array()), 'ICON' => 'btn-list'); } if ($psAdd) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PS_ADD'), 'TITLE' => GetMessage('CRM_PS_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PS_ADD'], array()), 'ICON' => 'btn-new'); } if ($psDelete && $arParams['TYPE'] == 'edit' && $exists) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_PS_DELETE'), 'TITLE' => GetMessage('CRM_PS_DELETE_TITLE'), 'LINK' => "javascript:ps_delete('" . GetMessage('CRM_PS_DELETE_DLG_TITLE') . "', '" . GetMessage('CRM_PS_DELETE_DLG_MESSAGE') . "', '" . GetMessage('CRM_PS_DELETE_DLG_BTNTITLE') . "', '" . CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_PS_EDIT'], array('ps_id' => $psID)), array('delete' => '', 'sessid' => bitrix_sessid())) . "')", 'ICON' => 'btn-delete'); } $this->IncludeComponentTemplate();
<?php define('NO_KEEP_STATISTIC', 'Y'); define('NO_AGENT_STATISTIC', 'Y'); require $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php'; if (!CModule::IncludeModule('crm')) { return; } global $APPLICATION; $CCrmPerms = new CCrmPerms($USER->GetID()); if (!$USER->IsAuthorized() || $CCrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) { return; } $arResult = array(); $_GET['USER_ID'] = preg_replace('/^(CONTACT|COMPANY|LEAD|DEAL)_/i' . BX_UTF_PCRE_MODIFIER, '', $_GET['USER_ID']); $iDealId = (int) $_GET['USER_ID']; if ($iDealId > 0) { __IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__)); $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_CONTACT_SHOW'] = CrmCheckPath('PATH_TO_CONTACT_SHOW', $arParams['PATH_TO_CONTACT_SHOW'], $APPLICATION->GetCurPage() . '?contact_id=#contact_id#&show'); $arParams['PATH_TO_COMPANY_SHOW'] = CrmCheckPath('PATH_TO_COMPANY_SHOW', $arParams['PATH_TO_COMPANY_SHOW'], $APPLICATION->GetCurPage() . '?company_id=#company_id#&show'); $arResult['STAGE_LIST'] = CCrmStatus::GetStatusListEx('DEAL_STAGE'); $obRes = CCrmDeal::GetList(array(), array('ID' => $iDealId)); $arDeal = $obRes->Fetch(); if ($arDeal == false) { return; } $res = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => 'DEAL', 'ELEMENT_ID' => $iDealId)); while ($ar = $res->Fetch()) { if (empty($arDeal[$ar['COMPLEX_ID']])) {
if ($ownerType == 'D') { $ownerName = 'DEAL'; } elseif ($ownerType == CCrmQuote::OWNER_TYPE) { $ownerName = 'QUOTE'; } elseif ($ownerType == 'L') { $ownerName = 'LEAD'; } elseif ($ownerType == 'I') { $ownerName = 'INVOICE'; } else { ShowError(GetMessage('CRM_UNSUPPORTED_OWNER_TYPE', array('#OWNER_TYPE#' => $ownerType))); return; } // Check permissions (READ by default) $permissionType = isset($arParams['PERMISSION_TYPE']) ? (string) $arParams['PERMISSION_TYPE'] : 'READ'; $perms = new CCrmPerms($USER->GetID()); if ($perms->HavePerm($ownerName, BX_CRM_PERM_NONE, $permissionType)) { ShowError(GetMessage('CRM_PERMISSION_DENIED')); return; } /** @var \CBitrixComponent $this */ $arResult['COMPONENT_ID'] = $this->randString(); $arResult['OWNER_TYPE'] = $ownerType; $arResult['OWNER_ID'] = $ownerID; $arResult['READ_ONLY'] = $permissionType == 'READ'; $arResult['INIT_EDITABLE'] = isset($arParams['INIT_EDITABLE']) ? $arParams['INIT_EDITABLE'] === 'Y' : false; $arResult['HIDE_MODE_BUTTON'] = isset($arParams['HIDE_MODE_BUTTON']) ? $arParams['HIDE_MODE_BUTTON'] === 'Y' : false; $arResult['HIDE_ALL_TAXES'] = isset($arParams['HIDE_ALL_TAXES']) ? $arParams['HIDE_ALL_TAXES'] === 'Y' : false; $arResult['ALLOW_TAX'] = isset($arParams['ALLOW_TAX']) ? $arParams['ALLOW_TAX'] === 'Y' : CCrmTax::isVatMode(); $arResult['ALLOW_TAX'] = $arResult['ALLOW_TAX'] && !$arResult['HIDE_ALL_TAXES']; $arResult['ALLOW_LD_TAX'] = isset($arParams['ALLOW_LD_TAX']) ? $arParams['ALLOW_LD_TAX'] === 'Y' : CCrmTax::isTaxMode(); $arResult['ALLOW_LD_TAX'] = $arResult['ALLOW_LD_TAX'] || $arResult['HIDE_ALL_TAXES'];
} global $USER, $APPLICATION; $arResult['LIST_SECTION_ID'] = isset($_REQUEST['list_section_id']) ? intval($_REQUEST['list_section_id']) : (isset($arParams['SECTION_ID']) ? intval($arParams['SECTION_ID']) : 0); $arParams['PATH_TO_PRODUCT_LIST'] = CrmCheckPath('PATH_TO_PRODUCT_LIST', $arParams['PATH_TO_PRODUCT_LIST'], '?#section_id#'); $arParams['PATH_TO_PRODUCT_SHOW'] = CrmCheckPath('PATH_TO_PRODUCT_SHOW', $arParams['PATH_TO_PRODUCT_SHOW'], '?product_id=#product_id#&show'); $arParams['PATH_TO_PRODUCT_EDIT'] = CrmCheckPath('PATH_TO_PRODUCT_EDIT', $arParams['PATH_TO_PRODUCT_EDIT'], '?product_id=#product_id#&edit'); $arParams['PATH_TO_PRODUCT_IMPORT'] = CrmCheckPath('PATH_TO_PRODUCT_IMPORT', $arParams['PATH_TO_PRODUCT_IMPORT'], $APPLICATION->GetCurPage() . '?import'); $arParams['PATH_TO_SECTION_LIST'] = CrmCheckPath('PATH_TO_SECTION_LIST', $arParams['PATH_TO_SECTION_LIST'], '?#section_id#§ions'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $sectionID = isset($arParams['SECTION_ID']) ? intval($arParams['SECTION_ID']) : 0; $productID = isset($arParams['PRODUCT_ID']) ? intval($arParams['PRODUCT_ID']) : 0; $CrmPerms = new CCrmPerms($USER->GetID()); $productAdd = $sectionAdd = $productEdit = $productDelete = $bImport = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); $productShow = $sectionShow = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'); $exists = $productID > 0 && CCrmProduct::Exists($productID); if ($arParams['TYPE'] === 'sections') { $arSection = false; if ($sectionShow && $sectionID > 0) { $rsSection = CIBlockSection::GetList(array(), array('ID' => $sectionID, 'GLOBAL_ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'), false, array('ID', 'IBLOCK_SECTION_ID')); $arSection = $rsSection->Fetch(); } if ($arSection) { $parentSectionID = isset($arSection['IBLOCK_SECTION_ID']) ? intval($arSection['IBLOCK_SECTION_ID']) : 0; $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_MOVE_UP'), 'TITLE' => GetMessage('CRM_MOVE_UP_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_SECTION_LIST'], array('section_id' => $parentSectionID)), 'ICON' => 'btn-parent-section'); } if ($sectionAdd) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_ADD_PRODUCT_SECTION'), 'TITLE' => GetMessage('CRM_ADD_PRODUCT_SECTION_TITLE'), 'LINK' => "javascript:BX.CrmProductSectionManager.getDefault().addSection();", 'ICON' => 'btn-add-section'); }
} if (count($settings) > 0) { $arSettings = CCrmProductRow::LoadSettings($ownerType, $ownerID); foreach ($settings as $k => $v) { $arSettings[$k] = $v; } CCrmProductRow::SaveSettings($ownerType, $ownerID, $arSettings); unset($arSettings); } } else { $arResponse['ERROR'] = 'OWNER_NOT_FOUND'; } } echo CUtil::PhpToJSObject($arResponse); } elseif ($mode === 'CALC_PRODUCT_PRICES') { if ($perms->HavePerm($ownerName, BX_CRM_PERM_NONE, 'READ')) { echo CUtil::PhpToJSObject(array('ERROR' => 'PERMISSION_DENIED')); die; } $data = isset($_POST['DATA']) && is_array($_POST['DATA']) ? $_POST['DATA'] : array(); if (count($data) == 0) { echo CUtil::PhpToJSObject(array('ERROR' => 'SOURCE_DATA_NOT_FOUND')); die; } //{ SRC_CURRENCY_ID:'RUB', SRC_EXCH_RATE:1, DST_CURRENCY_ID:'USD', PRODUCTS:[ { ID:1, PRICE:1.0 }...] } // National currency is default currency $srcCurrencyID = isset($data['SRC_CURRENCY_ID']) && strlen(strval($data['SRC_CURRENCY_ID'])) > 0 ? strval($data['SRC_CURRENCY_ID']) : CCrmCurrency::GetBaseCurrencyID(); // $srcExchRate = 0.0; // if(isset($data['SRC_EXCH_RATE'])) // { // $srcExchRate = doubleval($data['SRC_EXCH_RATE']);
if (!CModule::IncludeModule('crm')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $arParams['PATH_TO_VAT_LIST'] = CrmCheckPath('PATH_TO_VAT_LIST', $arParams['PATH_TO_VAT_LIST'], ''); $arParams['PATH_TO_VAT_SHOW'] = CrmCheckPath('PATH_TO_VAT_SHOW', $arParams['PATH_TO_VAT_SHOW'], '?vat_id=#vat_id#&show'); $arParams['PATH_TO_VAT_ADD'] = CrmCheckPath('PATH_TO_VAT_ADD', $arParams['PATH_TO_VAT_ADD'], '?add'); $arParams['PATH_TO_VAT_EDIT'] = CrmCheckPath('PATH_TO_VAT_EDIT', $arParams['PATH_TO_VAT_EDIT'], '?vat_id=#vat_id#&edit'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $vatID = isset($arParams['VAT_ID']) ? intval($arParams['VAT_ID']) : 0; $CrmPerms = new CCrmPerms($USER->GetID()); $vatAdd = $vatEdit = $vatDelete = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); $vatShow = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'); $exists = isset($vatID) && is_array(CCrmVat::GetByID($vatID)); if ($arParams['TYPE'] !== 'list') { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_VAT_LIST'), 'TITLE' => GetMessage('CRM_VAT_LIST_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_VAT_LIST'], array()), 'ICON' => 'btn-list'); } if ($vatAdd) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_VAT_ADD'), 'TITLE' => GetMessage('CRM_VAT_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_VAT_ADD'], array()), 'ICON' => 'btn-new'); } if ($arParams['TYPE'] == 'list') { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_VAT_SETTINGS'), 'TITLE' => GetMessage('CRM_VAT_SETTINGS_TITLE'), 'LINK' => "javascript:(new BX.CDialog({\n\t\t\t\t\t\t\t'content_url':'/bitrix/components/bitrix/crm.config.tax.settings/box.php',\n\t\t\t\t\t\t\t'width':'498',\n\t\t\t\t\t\t\t'height':'275',\n\t\t\t\t\t\t\t'resizable':false })).Show();", 'ICON' => 'btn-settings'); } if ($vatEdit && $arParams['TYPE'] == 'show' && $exists) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_VAT_EDIT'), 'TITLE' => GetMessage('CRM_VAT_EDIT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_VAT_EDIT'], array('vat_id' => $vatID)), 'ICON' => 'btn-edit'); } /*
public function RemoveRelation($RELATION_ID, $ENTITY_TYPE, $bPermCheck = true) { $RELATION_ID = intval($RELATION_ID); if (!in_array($ENTITY_TYPE, array('LEAD', 'CONTACT', 'COMPANY', 'DEAL', 'QUOTE'))) { return false; } if ($bPermCheck) { $CrmPerms = new CCrmPerms($this->currentUserID); if ($CrmPerms->HavePerm($ENTITY_TYPE, BX_CRM_PERM_NONE)) { return false; } } $sSql = "DELETE FROM b_crm_event_relations WHERE ID = {$RELATION_ID}"; $this->cdb->Query($sSql, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__); return true; }
if (!CModule::IncludeModule('sale')) { ShowError(GetMessage('CRM_SALE_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $arParams['PATH_TO_TAX_LIST'] = CrmCheckPath('PATH_TO_TAX_LIST', $arParams['PATH_TO_TAX_LIST'], ''); $arParams['PATH_TO_TAX_SHOW'] = CrmCheckPath('PATH_TO_TAX_SHOW', $arParams['PATH_TO_TAX_SHOW'], '?tax_id=#tax_id#&show'); $arParams['PATH_TO_TAX_ADD'] = CrmCheckPath('PATH_TO_TAX_ADD', $arParams['PATH_TO_TAX_ADD'], '?add'); $arParams['PATH_TO_TAX_EDIT'] = CrmCheckPath('PATH_TO_TAX_EDIT', $arParams['PATH_TO_TAX_EDIT'], '?tax_id=#tax_id#&edit'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $taxID = isset($arParams['TAX_ID']) ? strval($arParams['TAX_ID']) : ''; $CrmPerms = new CCrmPerms($USER->GetID()); $taxAdd = $taxEdit = $taxDelete = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); $taxShow = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'); $exists = intval($taxID > 0) && is_array(CCrmTax::GetByID($taxID)); if ($arParams['TYPE'] !== 'list') { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_TAX_LIST'), 'TITLE' => GetMessage('CRM_TAX_LIST_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_TAX_LIST'], array()), 'ICON' => 'btn-list'); } if ($taxAdd) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_TAX_ADD'), 'TITLE' => GetMessage('CRM_TAX_ADD_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_TAX_ADD'], array()), 'ICON' => 'btn-new'); } if ($arParams['TYPE'] == 'list') { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_TAX_SETTINGS'), 'TITLE' => GetMessage('CRM_TAX_SETTINGS_TITLE'), 'LINK' => "javascript:(new BX.CDialog({\n\t\t\t\t\t\t\t'content_url':'/bitrix/components/bitrix/crm.config.tax.settings/box.php',\n\t\t\t\t\t\t\t'width':'498',\n\t\t\t\t\t\t\t'height':'275',\n\t\t\t\t\t\t\t'resizable':false })).Show();", 'ICON' => 'btn-settings'); } if ($taxEdit && $arParams['TYPE'] == 'show' && $exists) { $arResult['BUTTONS'][] = array('TEXT' => GetMessage('CRM_TAX_EDIT'), 'TITLE' => GetMessage('CRM_TAX_EDIT_TITLE'), 'LINK' => CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_TAX_EDIT'], array('tax_id' => $taxID)), 'ICON' => 'btn-edit'); } /*
if (!CModule::IncludeModule('sale')) { ShowError(GetMessage('CRM_SALE_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $arParams['PATH_TO_LOCATIONS_LIST'] = CrmCheckPath('PATH_TO_LOCATIONS_LIST', $arParams['PATH_TO_LOCATIONS_LIST'], ''); $arParams['PATH_TO_LOCATIONS_ADD'] = CrmCheckPath('PATH_TO_LOCATIONS_ADD', $arParams['PATH_TO_LOCATIONS_ADD'], '?add'); $arParams['PATH_TO_LOCATIONS_EDIT'] = CrmCheckPath('PATH_TO_LOCATIONS_EDIT', $arParams['PATH_TO_LOCATIONS_EDIT'], '?loc_id=#loc_id#&edit'); $arParams['PATH_TO_LOCATIONS_IMPORT'] = CrmCheckPath('PATH_TO_LOCATIONS_IMPORT', $arParams['PATH_TO_LOCATIONS_IMPORT'], '?import'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } $arResult['BUTTONS'] = array(); $locID = isset($arParams['LOC_ID']) ? strval($arParams['LOC_ID']) : ''; $CrmPerms = new CCrmPerms($USER->GetID()); $locAdd = $locEdit = $locDelete = $locImport = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); if (CSaleLocation::isLocationProMigrated()) { $exists = intval($locID > 0) && CCrmLocations::CheckLocationExists($locID); } else { $exists = intval($locID > 0) && is_array(CCrmLocations::GetByID($locID)); } ######################## ######################## ######################## // LIST if ($arParams['TYPE'] == 'list') { $parentId = false; // STEP UP IN LIST if (CSaleLocation::isLocationProEnabled()) { $filterParentId = false; if (isset($_REQUEST['PARENT_ID'])) {
<?php define("STOP_STATISTICS", true); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; $arReturn = array(); if (!CModule::IncludeModule('crm')) { $arReturn['ERROR'][] = GetMessage('CRM_PS_MODULE_NOT_INSTALLED'); } if (!isset($arReturn['ERROR'])) { $CrmPerms = new CCrmPerms($USER->GetID()); $bCrmWritePerm = $CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE'); if ($USER->IsAuthorized() && check_bitrix_sessid() && $bCrmWritePerm) { $ID = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0; $personTypeId = isset($_REQUEST['person_type']) ? $_REQUEST['person_type'] : 0; $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : ''; switch ($action) { case 'get_fields': $arReturn['FIELDS'] = CCrmPaySystem::getPSCorrespondence($ID); $arReturn['FIELDS_LIST'] = implode(',', array_keys($arReturn['FIELDS'])); break; } } else { $arReturn['ERROR'][] = GetMessage('CRM_PS_ACCESS_DENIED'); } } $arReturn = $APPLICATION->ConvertCharsetArray($arReturn, SITE_CHARSET, 'utf-8'); echo json_encode($arReturn); require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/epilog_after.php";
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (CModule::IncludeModule('crm')) { global $USER; $USER_ID = $USER->GetID(); $CrmPerms = new CCrmPerms($USER_ID); $aMenuLinksExt = array(); if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE)) { $aMenuLinksExt = array(array("Справочники", "/crm/configs/status/", array(), array(), ""), array("Валюты", "/crm/configs/currency/", array(), array(), ""), array("Налоги", "/crm/configs/tax/", array(), array(), ""), array("Местоположения", "/crm/configs/locations/", array(), array(), ""), array("Способы оплаты", "/crm/configs/ps/", array(), array(), ""), array("Права доступа", "/crm/configs/perms/", array(), array(), ""), array("Бизнес-процессы", "/crm/configs/bp/", array(), array(), "CModule::IncludeModule('bizproc') && CModule::IncludeModule('bizprocdesigner')"), array("Пользовательские поля", "/crm/configs/fields/", array(), array(), ""), array("Прочее", "/crm/configs/config/", array(), array(), "CModule::IncludeModule('subscribe')"), array("Интеграция c почтой", "/crm/configs/sendsave/", array(), array(), "CModule::IncludeModule('mail')"), array("Интернет-магазины", "/crm/configs/external_sale/", array(), array(), ""), array("Интеграция с \"1С:Предприятие\"", "/crm/configs/exch1c/", array(), array(), ""), array("Справка", "/crm/configs/info/", array(), array(), "")); } if ($CrmPerms->IsAccessEnabled()) { $aMenuLinksExt[] = array("Почтовые шаблоны", "/crm/configs/mailtemplate/", array(), array(), ""); } $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt); }
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/.left.menu_ext.php"); if (CModule::IncludeModule('crm')) { $CrmPerms = new CCrmPerms($GLOBALS["USER"]->GetID()); $arMenuCrm = array(); if (SITE_TEMPLATE_ID === "bitrix24") { $arMenuCrm[] = array(GetMessage("MENU_CRM_DESKTOP"), "#SITE_DIR#crm/", array(), array(), ""); } $arMenuCrm[] = array(GetMessage("MENU_CRM_STREAM"), "#SITE_DIR#crm/stream/", array(), array(), ""); $arMenuCrm[] = array(GetMessage("MENU_CRM_ACTIVITY"), "#SITE_DIR#crm/activity/", array(), array(), ""); if (!$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("MENU_CRM_CONTACT"), "#SITE_DIR#crm/contact/", array(), array(), ""); } if (!$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("MENU_CRM_COMPANY"), "#SITE_DIR#crm/company/", array(), array(), ""); } if (!$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("MENU_CRM_DEAL"), "#SITE_DIR#crm/deal/", array(), array(), ""); } if (!$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("MENU_CRM_INVOICE"), "#SITE_DIR#crm/invoice/", array(), array(), ""); } if (!$CrmPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("MENU_CRM_QUOTE"), "#SITE_DIR#crm/quote/", array(), array(), ""); } if (!$CrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("MENU_CRM_LEAD"), "#SITE_DIR#crm/lead/", array(), array(), "");
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/invoice/.left.menu_ext.php"); if (CModule::IncludeModule('crm')) { $CrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); $aMenuLinksExt = array(); if (!$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'ADD')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_ADD_INVOICE"), '/crm/invoice/edit/0/', array(), array(), ''); } if (!$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_INVOICE_LIST"), '/crm/invoice/list/', array(), array(), ''); } $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt); }
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule('crm')) { return; } $CrmPerms = new CCrmPerms($USER->GetID()); if ($CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE)) { return; } $arParams['PATH_TO_INVOICE_LIST'] = CrmCheckPath('PATH_TO_INVOICE_LIST', $arParams['PATH_TO_INVOICE_LIST'], $APPLICATION->GetCurPage()); $arParams['PATH_TO_INVOICE_SHOW'] = CrmCheckPath('PATH_TO_INVOICE_SHOW', $arParams['PATH_TO_INVOICE_SHOW'], $APPLICATION->GetCurPage() . '?invoice_id=#invoice_id#&show'); $arParams['PATH_TO_INVOICE_PAYMENT'] = CrmCheckPath('PATH_TO_INVOICE_PAYMENT', $arParams['PATH_TO_INVOICE_PAYMENT'], $APPLICATION->GetCurPage() . '?invoice_id=#invoice_id#&payment'); $arParams['PATH_TO_INVOICE_EDIT'] = CrmCheckPath('PATH_TO_INVOICE_EDIT', $arParams['PATH_TO_INVOICE_EDIT'], $APPLICATION->GetCurPage() . '?invoice_id=#invoice_id#&edit'); if (!isset($arParams['TYPE'])) { $arParams['TYPE'] = 'list'; } if (isset($_REQUEST['copy'])) { $arParams['TYPE'] = 'copy'; } $arResult['TYPE'] = $arParams['TYPE']; $arResult['BUTTONS'] = array(); $arFields = array(); $arParams['ELEMENT_ID'] = intval($arParams['ELEMENT_ID']); if ($arParams['TYPE'] == 'list') { $bRead = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ'); $bExport = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'EXPORT'); $bImport = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'IMPORT'); $bAdd = !$CrmPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'ADD');
} if ($err_msg == "" && !CModule::IncludeModule('crm')) { $err_msg = "failure\n" . GetMessage('CRM_MODULE_NOT_INSTALLED'); } if ($err_msg == "" && !CModule::IncludeModule('catalog')) { $err_msg = "failure\n" . GetMessage('CATALOG_MODULE_NOT_INSTALLED'); } if ($err_msg == "" && !CModule::IncludeModule('sale')) { $err_msg = "failure\n" . GetMessage('SALE_MODULE_NOT_INSTALLED'); } $userPerms = CCrmPerms::GetCurrentUserPermissions(); if ($err_msg == "" && !CCrmPerms::IsAuthorized()) { $err_msg = "failure.\n" . GetMessage('CRM_EXCH1C_AUTH_ERROR'); } $crmPerms = new CCrmPerms($GLOBALS["USER"]->GetID()); if ($err_msg == "" && !CCrmPerms::IsAdmin() && !$crmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'WRITE')) { $err_msg = "failure.\n" . GetMessage('CRM_EXCH1C_PERMISSION_DENIED'); } $type = isset($_REQUEST["type"]) ? $_REQUEST["type"] : ""; if ($err_msg == "" && !in_array($type, array("sale", "catalog", "get_catalog"), true)) { $err_msg = "failure.\n" . GetMessage('CRM_EXCH1C_UNKNOWN_COMMAND_TYPE'); } if ($err_msg != "") { $APPLICATION->RestartBuffer(); echo $err_msg; return; } function OnCrmIblockXmlIdMiss(&$arFields) { global $APPLICATION; $APPLICATION->throwException(GetMessage('CRM_EXCH1C_UNKNOWN_XML_ID'));
if (isset($arSettings['COMPANY']) && $arSettings['COMPANY'] === 'Y') { $arSupportedTypes[] = 'COMPANY'; } if (isset($arSettings['DEAL']) && $arSettings['DEAL'] === 'Y') { $arSupportedTypes[] = 'DEAL'; } if (isset($arSettings['QUOTE']) && $arSettings['QUOTE'] === 'Y') { $arSupportedTypes[] = 'QUOTE'; } if (isset($arSettings['PRODUCT']) && $arSettings['PRODUCT'] === 'Y') { $arSupportedTypes[] = 'PRODUCT'; } $arParams['ENTITY_TYPE'] = array(); // only entity types are allowed for current user foreach ($arSupportedTypes as $supportedType) { if (!$CCrmPerms->HavePerm($supportedType, BX_CRM_PERM_NONE, 'READ')) { $arParams['ENTITY_TYPE'][] = $supportedType; } } $arResult['PREFIX'] = count($arSupportedTypes) > 1 ? 'Y' : 'N'; $arResult['MULTIPLE'] = $arParams['arUserField']['MULTIPLE']; if (!is_array($arResult['VALUE'])) { $arResult['VALUE'] = explode(';', $arResult['VALUE']); } else { $ar = array(); foreach ($arResult['VALUE'] as $value) { foreach (explode(';', $value) as $val) { if (!empty($val)) { $ar[$val] = $val; } }
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule('crm')) { return; } global $USER; $CCrmPerms = new CCrmPerms($USER->GetID()); if ($CCrmPerms->HavePerm($arParams['ENTITY_TYPE'], BX_CRM_PERM_NONE, 'READ')) { return; } if (!function_exists('__CrmEventGetPhones')) { function __CrmEventGetPhones($entityID, $elementID) { $result = array(); $arFields = CCrmFieldMulti::GetEntityFields($entityID, $elementID, 'PHONE', true, false); foreach ($arFields as $arField) { $result[] = array('TITLE' => $arField['ENTITY_NAME'], 'NUMBER' => $arField['VALUE']); } return $result; } } CUtil::InitJSCore(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $eventPage = isset($_POST['EVENT_PAGE']) ? $_POST['EVENT_PAGE'] : ''; if ($eventPage === '' || !CCrmUrlUtil::IsSecureUrl($eventPage)) { $eventPage = $GLOBALS['APPLICATION']->GetCurPage(); } $formID = isset($_POST['FORM_ID']) ? $_POST['FORM_ID'] : '';
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule('crm')) { ShowError(GetMessage('CRM_MODULE_NOT_INSTALLED')); return; } global $USER, $APPLICATION; $CrmPerms = new CCrmPerms($USER->GetID()); if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ')) { ShowError(GetMessage('CRM_PERMISSION_DENIED')); return; } $taxID = isset($arParams['TAX_ID']) ? strval($arParams['TAX_ID']) : ''; if ($taxID[0] <= 0) { $taxIDParName = isset($arParams['TAX_ID_PAR_NAME']) ? strval($arParams['TAX_ID_PAR_NAME']) : ''; if (strlen($taxIDParName) == 0) { $taxIDParName = 'tax_id'; } $taxID = isset($_REQUEST[$taxIDParName]) ? intval($_REQUEST[$taxIDParName]) : 0; } $arResult['SHOW_RATES'] = isset($_REQUEST['show_rates']) && $_REQUEST['show_rates'] == 'Y' ? true : false; $tax = array(); if ($taxID <= 0 || !($tax = CCrmTax::GetByID($taxID))) { ShowError(GetMessage('CRM_TAX_NOT_FOUND')); @define('ERROR_404', 'Y'); if ($arParams['SET_STATUS_404'] === 'Y') { CHTTP::SetStatus("404 Not Found"); }
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule('crm')) { return; } if (!CModule::IncludeModule('sale')) { return; } global $USER; $CCrmPerms = new CCrmPerms($USER->GetID()); if ($CCrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE, 'WRITE')) { return; } CUtil::InitJSCore(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (check_bitrix_sessid()) { $arResult['BACK_URL'] = isset($_POST['BACK_URL']) ? $_POST['BACK_URL'] : ''; $arResult['TAX_TYPE'] = isset($_POST['TAX_TYPE']) ? $_POST['TAX_TYPE'] : ''; if (strlen($arResult['TAX_TYPE']) > 0) { if ($arResult['TAX_TYPE'] == 'tax') { CCrmTax::unSetVatMode(); } elseif ($arResult['TAX_TYPE'] == 'vat') { CCrmTax::setVatMode(); } } } } else { $arResult['IS_VAT_MODE'] = CCrmTax::isVatMode();
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } if (CModule::IncludeModule('crm')) { $CrmPerms = new CCrmPerms($GLOBALS["USER"]->GetID()); $arMenuCrm = array(); if (!$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_CONTACT"), "#SITE_DIR#crm/contact/", array(), array(), ""); } if (!$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_COMPANY"), "#SITE_DIR#crm/company/", array(), array(), ""); } if (!$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_DEAL"), "#SITE_DIR#crm/deal/", array(), array(), ""); } if (!$CrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_LEAD"), "#SITE_DIR#crm/lead/", array(), array(), ""); } if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_PRODUCTS"), "#SITE_DIR#crm/product/", array(), array(), ""); } if (!$CrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE) || !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE) || !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE) || !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_EVENT"), "#SITE_DIR#crm/events/", array(), array(), ""); } if (!$CrmPerms->HavePerm('LEAD', BX_CRM_PERM_NONE) || !$CrmPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE) || !$CrmPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE) || !$CrmPerms->HavePerm('DEAL', BX_CRM_PERM_NONE)) { $arMenuCrm[] = array(GetMessage("CRM_REPORTS"), CModule::IncludeModule('report') ? "#SITE_DIR#crm/reports/report/" : "#SITE_DIR#crm/reports/", array(), array(), ""); $arMenuCrm[] = array(GetMessage("CRM_HELP"), "#SITE_DIR#crm/info/", array(), array(), ""); } if (!$CrmPerms->HavePerm('CONFIG', BX_CRM_PERM_NONE)) {
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/intranet/public/crm/quote/.left.menu_ext.php"); if (CModule::IncludeModule('crm')) { $CrmPerms = new CCrmPerms($GLOBALS['USER']->GetID()); $aMenuLinksExt = array(); if (!$CrmPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'ADD')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_ADD_QUOTE"), '#SITE_DIR#crm/quote/edit/0/', array(), array(), ''); } if (!$CrmPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ')) { $aMenuLinksExt[] = array(GetMessage("MENU_CRM_QUOTE_LIST"), '#SITE_DIR#crm/quote/list/', array(), array(), ''); } $aMenuLinks = array_merge($aMenuLinks, $aMenuLinksExt); }