Пример #1
0
    CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/locations/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.locations', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/locations/index.php'));
    CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/ps/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.ps', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/ps/index.php'));
    CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/reports/report/#', 'RULE' => '', 'ID' => 'bitrix:crm.report', 'PATH' => WIZARD_SITE_DIR . 'crm/reports/report/index.php'));
    CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/mailtemplate/#', 'RULE' => '', 'ID' => 'bitrix:crm.mail_template', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/mailtemplate/index.php'));
    CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/configs/exch1c/#', 'RULE' => '', 'ID' => 'bitrix:crm.config.exch1c', 'PATH' => WIZARD_SITE_DIR . 'crm/configs/exch1c/index.php'));
    CUrlRewriter::Add(array('CONDITION' => '#^' . WIZARD_SITE_DIR . 'crm/quote/#', 'RULE' => '', 'ID' => 'bitrix:crm.quote', 'PATH' => WIZARD_SITE_DIR . 'crm/quote/index.php'));
    CUrlRewriter::Add(array("CONDITION" => '#^' . WIZARD_SITE_DIR . 'crm/configs/measure/#', "RULE" => '', "ID" => 'bitrix:crm.config.measure', "PATH" => WIZARD_SITE_DIR . 'crm/configs/measure/index.php'));
    CUrlRewriter::Add(array("CONDITION" => '#^' . WIZARD_SITE_DIR . 'crm/configs/productprops/#', "RULE" => '', "ID" => "bitrix:crm.config.productprops", "PATH" => WIZARD_SITE_DIR . 'crm/configs/productprops/index.php'));
}
if (!WIZARD_IS_RERUN || COption::GetOptionString("crm", "form_features") == "Y") {
    // desktop on CRM index page
    $arOptions["GADGETS"] = array("CRM_MY_ACTIVITIES@1494" => array("COLUMN" => "0", "HIDE" => "N", "SETTINGS" => array("TITLE_STD" => GetMessage('CRM_GADGET_MY_ACTIVITY'), "SORT_BY" => "DESC", "ITEM_COUNT" => "5")), "CRM_DEAL_LIST@9562" => array("COLUMN" => "1", "ROW" => "0", "HIDE" => "N", "SETTINGS" => array("TITLE_STD" => GetMessage('CRM_GADGET_MY_DEAL_TITLE'), "STAGE_ID" => "WON", "ONLY_MY" => "N", "SORT" => "DATE_MODIFY", "SORT_BY" => "DESC", "DEAL_COUNT" => "3")), "CRM_LEAD_LIST@27424" => array("COLUMN" => "1", "ROW" => "2", "HIDE" => "N", "SETTINGS" => array("TITLE_STD" => GetMessage('CRM_GADGET_MY_LEAD_TITLE'), "STATUS_ID" => array("NEW", "ASSIGNED", "DETAILS", "CANNOT_CONTACT", "IN_PROCESS", "ON_HOLD", "RESTORED", "JUNK"), "ONLY_MY" => "N", "DATE_CREATE", "SORT_BY" => "DESC", "LEAD_COUNT" => "3")), "desktop-actions" => array("COLUMN" => 2, "ROW" => 0, "HIDE" => "N"));
    WizardServices::SetUserOption('intranet', '~gadgets_crm', $arOptions, $common = true);
}
if (WIZARD_INSTALL_DEMO_DATA && WIZARD_SITE_ID == "s1") {
    $CCrmRole = new CCrmRole();
    $arRoles = array('adm' => array('NAME' => GetMessage('CRM_ROLE_ADMIN'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'DEAL' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONTACT' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'INVOICE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONFIG' => array('WRITE' => array('-' => 'X')))), 'dir' => array('NAME' => GetMessage('CRM_ROLE_DIRECTOR'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'DEAL' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONTACT' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'INVOICE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')))), 'chif' => array('NAME' => GetMessage('CRM_ROLE_CHIF'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'DEAL' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'CONTACT' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'INVOICE' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')))), 'man' => array('NAME' => GetMessage('CRM_ROLE_MAN'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'DEAL' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'CONTACT' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'INVOICE' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')))));
    $iRoleIDAdm = $iRoleIDDir = $iRoleIDChif = $iRoleIDMan = 0;
    $obRole = CCrmRole::GetList(array(), array());
    while ($arRole = $obRole->Fetch()) {
        if ($arRole['NAME'] == GetMessage('CRM_ROLE_ADMIN')) {
            $iRoleIDAdm = $arRole['ID'];
        } else {
            if ($arRole['NAME'] == GetMessage('CRM_ROLE_DIRECTOR')) {
                $iRoleIDDir = $arRole['ID'];
            } else {
                if ($arRole['NAME'] == GetMessage('CRM_ROLE_CHIF')) {
                    $iRoleIDChif = $arRole['ID'];
                } else {
                    if ($arRole['NAME'] == GetMessage('CRM_ROLE_MAN')) {
                        $iRoleIDMan = $arRole['ID'];
Пример #2
0
 public static function GetEntityRelations($permEntity, $permAttr = self::PERM_NONE, $permType = 'READ')
 {
     global $DB;
     $arResult = array();
     $arRole = CCrmRole::GetRoleByAttr($permEntity, $permAttr, $permType);
     if (!empty($arRole)) {
         $sSql = 'SELECT RELATION FROM b_crm_role_relation WHERE ROLE_ID IN (' . implode(',', $arRole) . ')';
         $res = $DB->Query($sSql, false, 'FILE: ' . __FILE__ . '<br /> LINE: ' . __LINE__);
         while ($row = $res->Fetch()) {
             $arResult[] = $row['RELATION'];
         }
     }
     return $arResult;
 }
Пример #3
0
 public static function LocalComponentCausedUpdater()
 {
     global $stackCacheManager;
     $bResult = true;
     $errMsg = array();
     // at first, check last update version
     if (COption::GetOptionString('crm', '~CRM_QUOTE_14_1_11', 'N') === 'Y') {
         return $bResult;
     }
     try {
         // Copy perms from deals to quotes
         $CCrmRole = new CCrmRole();
         $dbRoles = $CCrmRole->GetList();
         while ($arRole = $dbRoles->Fetch()) {
             $arPerms = $CCrmRole->GetRolePerms($arRole['ID']);
             if (!isset($arPerms['QUOTE']) && is_array($arPerms['DEAL'])) {
                 foreach ($arPerms['DEAL'] as $key => $value) {
                     if (isset($value['-'])) {
                         $arPerms['QUOTE'][$key]['-'] = $value['-'];
                     } else {
                         $arPerms['QUOTE'][$key]['-'] = null;
                     }
                 }
             }
             $arFields = array('RELATION' => $arPerms);
             $CCrmRole->Update($arRole['ID'], $arFields);
         }
         // Create default quote status list (if not exists)
         $arStatus = CCrmStatus::GetStatus('QUOTE_STATUS');
         if (empty($arStatus)) {
             $CCrmStatus = new CCrmStatus('QUOTE_STATUS');
             $arAdd = array(array('NAME' => GetMessage('CRM_QUOTE_STATUS_DRAFT'), 'STATUS_ID' => 'DRAFT', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_SENT'), 'STATUS_ID' => 'SENT', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_RECEIVED'), 'STATUS_ID' => 'RECEIVED', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_APPROVED'), 'STATUS_ID' => 'APPROVED', 'SORT' => 40, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_UNANSWERED'), 'STATUS_ID' => 'UNANSWERED', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_DECLAINED'), 'STATUS_ID' => 'DECLAINED', 'SORT' => 60, 'SYSTEM' => 'Y'));
             foreach ($arAdd as $ar) {
                 $CCrmStatus->Add($ar);
             }
             $stackCacheManager->Clear('b_crm_status', 'QUOTE_STATUS');
         }
         unset($arStatus);
     } catch (Exception $e) {
         $errMsg[] = $e->getMessage();
     }
     if (empty($errMsg)) {
         COption::SetOptionString('crm', '~CRM_QUOTE_14_1_11', 'Y');
     } else {
         $errString = implode('<br>', $errMsg);
         ShowError($errString);
         $bResult = false;
     }
     return $bResult;
 }
Пример #4
0
 private static function ClearCache()
 {
     // Clean up cached permissions
     self::$PERMISSIONS_BY_USER = array();
     CrmClearMenuCache();
 }
Пример #5
0
        }
    }
    if (empty($arResult['ERROR_MESSAGE'])) {
        if (isset($_POST['apply'])) {
            LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_ROLE_EDIT'], array('role_id' => $arParams['ROLE_ID'])));
        } else {
            LocalRedirect($arParams['PATH_TO_ENTITY_LIST']);
        }
    } else {
        ShowError($arResult['ERROR_MESSAGE']);
    }
    $arResult['ROLE'] = array('ID' => $arParams['ROLE_ID'], 'NAME' => $arFields['NAME']);
    $arResult['ROLE_PERMS'] = $arFields['RELATION'];
} else {
    if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['delete']) && check_bitrix_sessid() && $arParams['ROLE_ID'] > 0) {
        $CCrmRole = new CCrmRole();
        $CCrmRole->Delete($arParams['ROLE_ID']);
        LocalRedirect($arParams['PATH_TO_ENTITY_LIST']);
    }
}
if (!$bVarsFromForm) {
    if ($arParams['ROLE_ID'] > 0) {
        $obRes = CCrmRole::GetList(array(), array('ID' => $arParams['ROLE_ID']));
        $arResult['ROLE'] = $obRes->Fetch();
        if ($arResult['ROLE'] == false) {
            $arParams['ROLE_ID'] = 0;
        }
    }
    if ($arParams['ROLE_ID'] <= 0) {
        $arResult['ROLE']['ID'] = 0;
        $arResult['ROLE']['NAME'] = '';
Пример #6
0
                    unset($local_err);
                    COption::SetOptionString('crm', '~CRM_INVOICE_PRODUCTS_CONVERTED_12_5_7', 'Y');
                } else {
                    $errMsg[] = Loc::getMessage('CRM_UPDATE_ERR_005');
                    return;
                }
            }
        } else {
            $errMsg[] = Loc::getMessage('CRM_UPDATE_ERR_004');
            return;
        }
    }
}
if (empty($errMsg)) {
    //Copy perms from deals to invoices
    $CCrmRole = new CCrmRole();
    $dbRoles = $CCrmRole->GetList();
    while ($arRole = $dbRoles->Fetch()) {
        $arPerms = $CCrmRole->GetRolePerms($arRole['ID']);
        if (!isset($arPerms['INVOICE']) && is_array($arPerms['DEAL'])) {
            foreach ($arPerms['DEAL'] as $key => $value) {
                if (isset($value['-']) && $value['-'] != 'O') {
                    $arPerms['INVOICE'][$key]['-'] = $value['-'];
                } else {
                    $arPerms['INVOICE'][$key]['-'] = 'X';
                }
            }
        }
        $arFields = array('RELATION' => $arPerms);
        $CCrmRole->Update($arRole['ID'], $arFields);
    }
Пример #7
0
    LocalRedirect($APPLICATION->GetCurPage());
}
// get role list
$arResult['PATH_TO_ROLE_ADD'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_ROLE_EDIT'], array('role_id' => 0));
$arResult['ROLE'] = array();
$obRes = CCrmRole::GetList();
while ($arRole = $obRes->Fetch()) {
    $arRole['PATH_TO_EDIT'] = CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_ROLE_EDIT'], array('role_id' => $arRole['ID']));
    $arRole['PATH_TO_DELETE'] = CHTTP::urlAddParams(CComponentEngine::MakePathFromTemplate($arParams['PATH_TO_ROLE_EDIT'], array('role_id' => $arRole['ID'])), array('delete' => '1', 'sessid' => bitrix_sessid()));
    $arRole['NAME'] = htmlspecialcharsbx($arRole['NAME']);
    $arResult['ROLE'][$arRole['ID']] = $arRole;
}
// get role relation
$arResult['RELATION'] = array();
$arResult['RELATION_ENTITY'] = array();
$obRes = CCrmRole::GetRelation();
while ($arRelation = $obRes->Fetch()) {
    $arResult['RELATION'][$arRelation['RELATION']] = $arRelation;
    $arResult['RELATION_ENTITY'][$arRelation['RELATION']] = true;
}
$CAccess = new CAccess();
$arNames = $CAccess->GetNames(array_keys($arResult['RELATION_ENTITY']));
foreach ($arResult['RELATION'] as &$arRelation) {
    //Issue #43598
    $arRelation['NAME'] = htmlspecialcharsbx($arNames[$arRelation['RELATION']]['name']);
    $providerName = $arNames[$arRelation['RELATION']]['provider'];
    if (!empty($providerName)) {
        $arRelation['NAME'] = '<b>' . htmlspecialcharsbx($providerName) . ':</b> ' . $arRelation['NAME'];
    }
}
unset($arRelation);
Пример #8
0
 function InstallDB()
 {
     global $DB, $APPLICATION, $USER;
     global $USER_FIELD_MANAGER;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_crm_lead", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/crm/install/db/' . strtolower($DB->type) . '/install.sql');
         //COption::SetOptionString('crm', 'GROUP_DEFAULT_RIGHT', 'R');
         require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/crm/include.php';
         // Create default status list
         $CCrmStatus = new CCrmStatus('STATUS');
         $arAdd = array(array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_NEW'), 'STATUS_ID' => 'NEW', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_ASSIGNED'), 'STATUS_ID' => 'ASSIGNED', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_DETAILS'), 'STATUS_ID' => 'DETAILS', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_CANNOT_CONTACT'), 'STATUS_ID' => 'CANNOT_CONTACT', 'SORT' => 40, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_IN_PROCESS'), 'STATUS_ID' => 'IN_PROCESS', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_ON_HOLD'), 'STATUS_ID' => 'ON_HOLD', 'SORT' => 60, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_RESTORED'), 'STATUS_ID' => 'RESTORED', 'SORT' => 70, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_CONVERTED'), 'STATUS_ID' => 'CONVERTED', 'SORT' => 80, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_STATUS_TYPE_STATUS_JUNK'), 'STATUS_ID' => 'JUNK', 'SORT' => 90, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default source list
         $CCrmStatus = new CCrmStatus('SOURCE');
         $arAdd = array(array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_SELF'), 'STATUS_ID' => 'SELF', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_PARTNER'), 'STATUS_ID' => 'PARTNER', 'SORT' => 20), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_CALL'), 'STATUS_ID' => 'CALL', 'SORT' => 30), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_WEB'), 'STATUS_ID' => 'WEB', 'SORT' => 40), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_EMAIL'), 'STATUS_ID' => 'EMAIL', 'SORT' => 50), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_CONFERENCE'), 'STATUS_ID' => 'CONFERENCE', 'SORT' => 60), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_TRADE_SHOW'), 'STATUS_ID' => 'TRADE_SHOW', 'SORT' => 70), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_EMPLOYEE'), 'STATUS_ID' => 'EMPLOYEE', 'SORT' => 80), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_COMPANY'), 'STATUS_ID' => 'COMPANY', 'SORT' => 90), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_HR'), 'STATUS_ID' => 'HR', 'SORT' => 100), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_MAIL'), 'STATUS_ID' => 'MAIL', 'SORT' => 110), array('NAME' => GetMessage('CRM_STATUS_TYPE_SOURCE_OTHER'), 'STATUS_ID' => 'OTHER', 'SORT' => 120));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default contact type list
         $CCrmStatus = new CCrmStatus('CONTACT_TYPE');
         $arAdd = array(array('NAME' => GetMessage('CRM_CONTACT_TYPE_SHARE'), 'STATUS_ID' => 'SHARE', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_CONTACT_TYPE_JOURNALIST'), 'STATUS_ID' => 'JOURNALIST', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_CONTACT_TYPE_CLIENT'), 'STATUS_ID' => 'CLIENT', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_CONTACT_TYPE_SUPPLIER'), 'STATUS_ID' => 'SUPPLIER', 'SORT' => 40, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_CONTACT_TYPE_PARTNER'), 'STATUS_ID' => 'PARTNER', 'SORT' => 50, 'SYSTEM' => 'N'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default contact type list
         $CCrmStatus = new CCrmStatus('COMPANY_TYPE');
         $arAdd = array(array('NAME' => GetMessage('CRM_COMPANY_TYPE_CUSTOMER'), 'STATUS_ID' => 'CUSTOMER', 'SORT' => 10, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_PARTNER'), 'STATUS_ID' => 'PARTNER', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_RESELLER'), 'STATUS_ID' => 'RESELLER', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_COMPETITOR'), 'STATUS_ID' => 'COMPETITOR', 'SORT' => 40, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_INVESTOR'), 'STATUS_ID' => 'INVESTOR', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_INTEGRATOR'), 'STATUS_ID' => 'INTEGRATOR', 'SORT' => 60, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_PROSPECT'), 'STATUS_ID' => 'PROSPECT', 'SORT' => 70, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_PRESS'), 'STATUS_ID' => 'PRESS', 'SORT' => 80, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_COMPANY_TYPE_OTHER'), 'STATUS_ID' => 'OTHER', 'SORT' => 90, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         $CCrmStatus = new CCrmStatus('EMPLOYEES');
         $arAdd = array(array('NAME' => GetMessage('CRM_EMPLOYEES_1'), 'STATUS_ID' => 'EMPLOYEES_1', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_EMPLOYEES_2'), 'STATUS_ID' => 'EMPLOYEES_2', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_EMPLOYEES_3'), 'STATUS_ID' => 'EMPLOYEES_3', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_EMPLOYEES_4'), 'STATUS_ID' => 'EMPLOYEES_4', 'SORT' => 40, 'SYSTEM' => 'N'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default industry  list
         $CCrmStatus = new CCrmStatus('INDUSTRY');
         $arAdd = array(array('NAME' => GetMessage('CRM_INDUSTRY_IT'), 'STATUS_ID' => 'IT', 'SORT' => 10, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_TELECOM'), 'STATUS_ID' => 'TELECOM', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_MANUFACTURING'), 'STATUS_ID' => 'MANUFACTURING', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_BANKING'), 'STATUS_ID' => 'BANKING', 'SORT' => 40, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_CONSULTING'), 'STATUS_ID' => 'CONSULTING', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_FINANCE'), 'STATUS_ID' => 'FINANCE', 'SORT' => 60, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_GOVERNMENT'), 'STATUS_ID' => 'GOVERNMENT', 'SORT' => 70, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_DELIVERY'), 'STATUS_ID' => 'DELIVERY', 'SORT' => 80, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_ENTERTAINMENT'), 'STATUS_ID' => 'ENTERTAINMENT', 'SORT' => 90, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_NOTPROFIT'), 'STATUS_ID' => 'NOTPROFIT', 'SORT' => 100, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_INDUSTRY_OTHER'), 'STATUS_ID' => 'OTHER', 'SORT' => 110, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default deal type list
         $CCrmStatus = new CCrmStatus('DEAL_TYPE');
         $arAdd = array(array('NAME' => GetMessage('CRM_DEAL_TYPE_SALE'), 'STATUS_ID' => 'SALE', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_DEAL_TYPE_COMPLEX'), 'STATUS_ID' => 'COMPLEX', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_TYPE_GOODS'), 'STATUS_ID' => 'GOODS', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_TYPE_SERVICES'), 'STATUS_ID' => 'SERVICES', 'SORT' => 40, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_TYPE_SERVICE'), 'STATUS_ID' => 'SERVICE', 'SORT' => 50, 'SYSTEM' => 'N'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default deal stage list
         $CCrmStatus = new CCrmStatus('DEAL_STAGE');
         $arAdd = array(array('NAME' => GetMessage('CRM_DEAL_STAGE_NEW'), 'STATUS_ID' => 'NEW', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_DEAL_STAGE_DETAILS'), 'STATUS_ID' => 'DETAILS', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_STAGE_PROPOSAL'), 'STATUS_ID' => 'PROPOSAL', 'SORT' => 40, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_STAGE_NEGOTIATION'), 'STATUS_ID' => 'NEGOTIATION', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_STAGE_WON'), 'STATUS_ID' => 'WON', 'SORT' => 70, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_DEAL_STAGE_ON_HOLD'), 'STATUS_ID' => 'ON_HOLD', 'SORT' => 75, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_STAGE_LOSE'), 'STATUS_ID' => 'LOSE', 'SORT' => 80, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default deal state list
         $CCrmStatus = new CCrmStatus('DEAL_STATE');
         $arAdd = array(array('NAME' => GetMessage('CRM_DEAL_STATE_PLANNED'), 'STATUS_ID' => 'PLANNED', 'SORT' => 10, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_DEAL_STATE_PROCESS'), 'STATUS_ID' => 'PROCESS', 'SORT' => 20, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_DEAL_STATE_COMPLETE'), 'STATUS_ID' => 'COMPLETE', 'SORT' => 30, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_DEAL_STATE_CANCELED'), 'STATUS_ID' => 'CANCELED', 'SORT' => 40, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default event type
         $CCrmStatus = new CCrmStatus('EVENT_TYPE');
         $arAdd = array(array('NAME' => GetMessage('CRM_EVENT_TYPE_INFO'), 'STATUS_ID' => 'INFO', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_EVENT_TYPE_PHONE'), 'STATUS_ID' => 'PHONE', 'SORT' => 20, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_EVENT_TYPE_MESSAGE'), 'STATUS_ID' => 'MESSAGE', 'SORT' => 30, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         // Create default quote status list
         $CCrmStatus = new CCrmStatus('QUOTE_STATUS');
         $arAdd = array(array('NAME' => GetMessage('CRM_QUOTE_STATUS_DRAFT'), 'STATUS_ID' => 'DRAFT', 'SORT' => 10, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_SENT'), 'STATUS_ID' => 'SENT', 'SORT' => 20, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_RECEIVED'), 'STATUS_ID' => 'RECEIVED', 'SORT' => 30, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_APPROVED'), 'STATUS_ID' => 'APPROVED', 'SORT' => 40, 'SYSTEM' => 'Y'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_UNANSWERED'), 'STATUS_ID' => 'UNANSWERED', 'SORT' => 50, 'SYSTEM' => 'N'), array('NAME' => GetMessage('CRM_QUOTE_STATUS_DECLAINED'), 'STATUS_ID' => 'DECLAINED', 'SORT' => 60, 'SYSTEM' => 'Y'));
         foreach ($arAdd as $ar) {
             $CCrmStatus->Add($ar);
         }
         $directionId = 0;
         $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "DIRECTION"));
         if ($arGroup = $dbGroup->Fetch()) {
             $directionId = $arGroup["ID"];
         }
         $marketingId = 0;
         $dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "MARKETING_AND_SALES"));
         if ($arGroup = $dbGroup->Fetch()) {
             $marketingId = $arGroup["ID"];
         }
         $CCrmRole = new CCrmRole();
         $arRoles = array('adm' => array('NAME' => GetMessage('CRM_ROLE_ADMIN'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'DEAL' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONTACT' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'INVOICE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONFIG' => array('WRITE' => array('-' => 'X')))), 'dir' => array('NAME' => GetMessage('CRM_ROLE_DIRECTOR'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'DEAL' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'CONTACT' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'INVOICE' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')))), 'chif' => array('NAME' => GetMessage('CRM_ROLE_CHIF'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'DEAL' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'CONTACT' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')), 'INVOICE' => array('READ' => array('-' => 'D'), 'EXPORT' => array('-' => 'D'), 'IMPORT' => array('-' => 'D'), 'ADD' => array('-' => 'D'), 'WRITE' => array('-' => 'D'), 'DELETE' => array('-' => 'D')))), 'man' => array('NAME' => GetMessage('CRM_ROLE_MAN'), 'RELATION' => array('LEAD' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'DEAL' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'CONTACT' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'COMPANY' => array('READ' => array('-' => 'X'), 'EXPORT' => array('-' => 'X'), 'IMPORT' => array('-' => 'X'), 'ADD' => array('-' => 'X'), 'WRITE' => array('-' => 'X'), 'DELETE' => array('-' => 'X')), 'QUOTE' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')), 'INVOICE' => array('READ' => array('-' => 'A'), 'EXPORT' => array('-' => 'A'), 'IMPORT' => array('-' => 'A'), 'ADD' => array('-' => 'A'), 'WRITE' => array('-' => 'A'), 'DELETE' => array('-' => 'A')))));
         $iRoleID = $CCrmRole->Add($arRoles['adm']);
         $iRoleID = $CCrmRole->Add($arRoles['dir']);
         $arRel = array();
         if ($directionId > 0) {
             $arRel['G' . $directionId] = array($iRoleID);
         }
         $iRoleID = $CCrmRole->Add($arRoles['chif']);
         $iRoleID = $CCrmRole->Add($arRoles['man']);
         if ($marketingId > 0) {
             $arRel['G' . $marketingId] = array($iRoleID);
         }
         $CCrmRole->SetRelation($arRel);
     }
     $this->InstallUserFields();
     //FILL BUSINESS TYPES -->
     $dbType = strtoupper($DB->type);
     if ($dbType === "ORACLE") {
         $dbResult = $DB->Query("SELECT COUNT(1) AS QTY FROM B_CRM_BIZ_TYPE");
     } elseif ($dbType === "MSSQL") {
         $dbResult = $DB->Query("SELECT COUNT(*) AS QTY FROM B_CRM_BIZ_TYPE");
     } else {
         $dbResult = $DB->Query("SELECT COUNT(*) AS QTY FROM b_crm_biz_type");
     }
     $arResult = is_object($dbResult) ? $dbResult->Fetch() : null;
     $qty = is_array($arResult) && isset($arResult["QTY"]) ? intval($arResult["QTY"]) : 0;
     if ($qty === 0) {
         $allLangIDs = array();
         $sort = 'sort';
         $order = 'asc';
         $langEntity = new \CLanguage();
         $dbLangs = $langEntity->GetList($sort, $order);
         while ($lang = $dbLangs->Fetch()) {
             if (isset($lang['LID'])) {
                 $allLangIDs[] = $lang['LID'];
             }
         }
         foreach ($allLangIDs as $langID) {
             $langFile = $_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/crm/lang/' . $langID . "/lib/businesstype.php";
             if (!file_exists($langFile)) {
                 continue;
             }
             //include($langFile);
             $messages = __IncludeLang($langFile, true);
             $s = isset($messages["CRM_BIZ_TYPE_DEFAULT"]) ? trim($messages["CRM_BIZ_TYPE_DEFAULT"]) : "";
             if ($s === ' ' || $s === '-') {
                 continue;
             }
             $bizTypeTableName = $dbType === 'ORACLE' || $dbType === 'MSSQL' ? 'B_CRM_BIZ_TYPE' : 'b_crm_biz_type';
             foreach (explode('|', $s) as $slug) {
                 $ary = explode(';', $slug);
                 if (count($ary) < 2) {
                     continue;
                 }
                 $code = $DB->ForSql($ary[0]);
                 $name = $DB->ForSql($ary[1]);
                 $lang = isset($ary[2]) ? $DB->ForSql($ary[2]) : '';
                 $DB->Query("INSERT INTO {$bizTypeTableName}(CODE, NAME, LANG) VALUES('{$code}', '{$name}', '{$lang}')");
             }
         }
     }
     //<-- FILL BUSINESS TYPES
     RegisterModule('crm');
     RegisterModuleDependences('mail', 'OnGetFilterList', 'crm', 'CCrmEMail', 'OnGetFilterList');
     RegisterModuleDependences('main', 'OnUserTypeBuildList', 'crm', 'CUserTypeCrm', 'GetUserTypeDescription');
     RegisterModuleDependences('main', 'OnUserTypeBuildList', 'crm', 'CUserTypeCrmStatus', 'GetUserTypeDescription');
     RegisterModuleDependences('search', 'OnReindex', 'crm', 'CCrmSearch', 'OnSearchReindex');
     RegisterModuleDependences('search', 'OnSearchCheckPermissions', 'crm', 'CCrmSearch', 'OnSearchCheckPermissions');
     RegisterModuleDependences('report', 'OnReportAdd', 'crm', 'CCrmReportHelper', 'clearMenuCache');
     RegisterModuleDependences('report', 'OnReportUpdate', 'crm', 'CCrmReportHelper', 'clearMenuCache');
     RegisterModuleDependences('report', 'OnReportDelete', 'crm', 'CCrmReportHelper', 'clearMenuCache');
     RegisterModuleDependences('iblock', 'OnIBlockDelete', 'crm', 'CAllCrmCatalog', 'OnIBlockDelete');
     RegisterModuleDependences('iblock', 'OnAfterIBlockElementDelete', 'crm', 'CCrmProduct', 'OnIBlockElementDelete');
     RegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'crm', 'CCrmExternalSaleImport', 'OnFillSocNetLogEvents');
     RegisterModuleDependences('tasks', 'OnBeforeTaskAdd', 'crm', 'CAllCrmActivity', 'OnBeforeTaskAdd');
     RegisterModuleDependences('tasks', 'OnTaskAdd', 'crm', 'CAllCrmActivity', 'OnTaskAdd');
     RegisterModuleDependences('tasks', 'OnTaskUpdate', 'crm', 'CAllCrmActivity', 'OnTaskUpdate');
     RegisterModuleDependences('tasks', 'OnTaskDelete', 'crm', 'CAllCrmActivity', 'OnTaskDelete');
     RegisterModuleDependences('webdav', 'OnFileDelete', 'crm', 'CCrmWebDavHelper', 'OnWebDavFileDelete');
     RegisterModuleDependences('subscribe', 'BeforePostingSendMail', 'crm', 'CCrmEMail', 'BeforeSendMail');
     RegisterModuleDependences('calendar', 'OnAfterCalendarEventEdit', 'crm', 'CAllCrmActivity', 'OnCalendarEventEdit');
     RegisterModuleDependences('calendar', 'OnAfterCalendarEventDelete', 'crm', 'CAllCrmActivity', 'OnCalendarEventDelete');
     RegisterModuleDependences('crm', 'OnCrmStatusGetList', 'crm', 'CCrmStatusInvoice', 'getStatusList');
     RegisterModuleDependences('crm', 'OnGetEntityTypes', 'crm', 'CCrmStatusInvoice', 'onGetEntityTypes');
     RegisterModuleDependences('crm', 'OnBeforeCrmStatusCreate', 'crm', 'CCrmStatusInvoice', 'createCrmStatus');
     RegisterModuleDependences('rest', 'onRestServiceBuildDescription', 'crm', 'CCrmRestService', 'onRestServiceBuildDescription');
     RegisterModuleDependences('rest', 'onRestServiceBuildDescription', 'crm', 'CCrmInvoiceRestService', 'OnRestServiceBuildDescription');
     RegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'crm', 'CCrmLiveFeed', 'OnFillSocNetAllowedSubscribeEntityTypes');
     RegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'crm', 'CCrmLiveFeed', 'OnFillSocNetLogEvents');
     RegisterModuleDependences('socialnetwork', 'OnFillSocNetLogFields', 'crm', 'CCrmLiveFeed', 'OnFillSocNetLogFields');
     RegisterModuleDependences('socialnetwork', 'OnBuildSocNetLogFilter', 'crm', 'CCrmLiveFeed', 'OnBuildSocNetLogFilter');
     RegisterModuleDependences('socialnetwork', 'OnBuildSocNetLogOrder', 'crm', 'CCrmLiveFeed', 'OnBuildSocNetLogOrder');
     RegisterModuleDependences('socialnetwork', 'OnSocNetLogFormatDestination', 'crm', 'CCrmLiveFeed', 'OnSocNetLogFormatDestination');
     RegisterModuleDependences('socialnetwork', 'OnBuildSocNetLogPerms', 'crm', 'CCrmLiveFeed', 'OnBuildSocNetLogPerms');
     RegisterModuleDependences('socialnetwork', 'OnBeforeSocNetLogRightsAdd', 'crm', 'CCrmLiveFeed', 'OnBeforeSocNetLogRightsAdd');
     RegisterModuleDependences('socialnetwork', 'OnBeforeSocNetLogCommentCounterIncrement', 'crm', 'CCrmLiveFeed', 'OnBeforeSocNetLogCommentCounterIncrement');
     RegisterModuleDependences('socialnetwork', 'OnAfterSocNetLogEntryCommentAdd', 'crm', 'CCrmLiveFeed', 'OnAfterSocNetLogEntryCommentAdd');
     RegisterModuleDependences('socialnetwork', 'OnBeforeSocNetLogEntryGetRights', 'crm', 'CCrmLiveFeed', 'OnBeforeSocNetLogEntryGetRights');
     RegisterModuleDependences("socialnetwork", "OnSendMentionGetEntityFields", "crm", "CCrmLiveFeed", "OnSendMentionGetEntityFields");
     RegisterModuleDependences('main', 'OnAddRatingVote', 'crm', 'CCrmLiveFeed', 'OnAddRatingVote');
     RegisterModuleDependences('forum', 'OnAfterCommentAdd', 'crm', 'CCrmLiveFeed', 'onAfterCommentAdd');
     RegisterModuleDependences("main", "OnApplicationsBuildList", "main", '\\Bitrix\\Crm\\Integration\\Application', "OnApplicationsBuildList", 100, "modules/crm/lib/integration/application.php");
     RegisterModuleDependences('disk', 'onAfterDeleteFile', 'crm', '\\Bitrix\\Crm\\Integration\\DiskManager', 'OnDiskFileDelete');
     if (is_array($this->errors)) {
         $GLOBALS['errors'] = $this->errors;
         $APPLICATION->ThrowException(implode(' ', $this->errors));
         return false;
     }
     return true;
 }