本文整理汇总了PHP中Bitrix\Main\ModuleManager::isModuleInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleManager::isModuleInstalled方法的具体用法?PHP ModuleManager::isModuleInstalled怎么用?PHP ModuleManager::isModuleInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\ModuleManager
的用法示例。
在下文中一共展示了ModuleManager::isModuleInstalled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSecurityContextByUser
/**
* Gets security context (access provider) for user.
* Attention! File/Folder can use anywhere and SecurityContext have to check rights anywhere (any module).
* @param mixed $user User which use for check rights.
* @return SecurityContext
*/
public function getSecurityContextByUser($user)
{
if ($this->isCurrentUser($user)) {
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if (Loader::includeModule('socialnetwork') && \CSocnetUser::isCurrentUserModuleAdmin()) {
return new FakeSecurityContext($user);
}
if (UserModel::isCurrentUserAdmin()) {
return new FakeSecurityContext($user);
}
} else {
$userId = UserModel::resolveUserId($user);
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
if ($userId && Loader::includeModule('socialnetwork') && \CSocnetUser::isUserModuleAdmin($userId)) {
return new FakeSecurityContext($user);
}
try {
if ($userId && ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24') && \CBitrix24::isPortalAdmin($userId)) {
return new FakeSecurityContext($user);
} elseif ($userId) {
//Check user group 1 ('Admins')
$tmpUser = new \CUser();
$arGroups = $tmpUser->getUserGroup($userId);
if (in_array(1, $arGroups)) {
return new FakeSecurityContext($user);
}
}
} catch (\Exception $e) {
}
}
return new DiskSecurityContext($user);
}
示例2: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!Loader::includeModule('search')) {
throw new BitrixException('Search module is not installed');
}
$searchResult = array();
$bar = new ProgressBar($output, 0);
do {
$bar->display();
$searchResult = \CSearch::ReIndexAll($input->getOption('full'), static::UPDATE_TIME, $searchResult);
$bar->advance();
$bar->clear();
if (is_array($searchResult) && $searchResult['MODULE'] == 'main') {
list(, $path) = explode("|", $searchResult["ID"], 2);
$output->writeln("\r " . $path, OutputInterface::VERBOSITY_VERBOSE);
}
} while (is_array($searchResult));
$bar->finish();
$bar->clear();
$output->write("\r");
if (ModuleManager::isModuleInstalled('socialnetwork')) {
$output->writeln('<info>The Social Network module needs to be reindexed using the Social Network component in the public section of site.</info>');
}
$output->writeln(sprintf('<info>Reindexed</info> %d element%s.', $searchResult, $searchResult > 1 ? 's' : ''));
return 0;
}
示例3: isExternalUser
/**
* Check if user is extranet user
* @param integer $userID User ID
* @return boolean
*/
public static function isExternalUser($userID)
{
if (!ModuleManager::isModuleInstalled('extranet')) {
return false;
}
$dbResult = \CUser::getList($o = 'ID', $b = 'ASC', array('ID_EQUAL_EXACT' => $userID), array('FIELDS' => array('ID'), 'SELECT' => array('UF_DEPARTMENT')));
$user = $dbResult->Fetch();
return !(is_array($user) && isset($user['UF_DEPARTMENT']) && isset($user['UF_DEPARTMENT'][0]) && $user['UF_DEPARTMENT'][0] > 0);
}
示例4: getActiveUsersCount
public static function getActiveUsersCount()
{
$sql = "SELECT COUNT(ID) " . "FROM b_user " . "WHERE ACTIVE = 'Y' " . " AND LAST_LOGIN IS NOT NULL";
if (ModuleManager::isModuleInstalled("intranet")) {
$sql = "SELECT COUNT(U.ID) " . "FROM b_user U " . "WHERE U.ACTIVE = 'Y' " . " AND U.LAST_LOGIN IS NOT NULL " . " AND EXISTS(" . " SELECT 'x' " . " FROM b_utm_user UF, b_user_field F " . " WHERE F.ENTITY_ID = 'USER' " . " AND F.FIELD_NAME = 'UF_DEPARTMENT' " . " AND UF.FIELD_ID = F.ID " . " AND UF.VALUE_ID = U.ID " . " AND UF.VALUE_INT IS NOT NULL " . " AND UF.VALUE_INT <> 0" . " )";
}
$connection = Application::getConnection();
return $connection->queryScalar($sql);
}
示例5: isPaidLicense
public static function isPaidLicense()
{
if (self::$isLicensePaid !== null) {
return self::$isLicensePaid;
}
if (!(ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24')) && method_exists('CBitrix24', 'IsLicensePaid')) {
return self::$isLicensePaid = false;
}
return self::$isLicensePaid = \CBitrix24::IsLicensePaid();
}
示例6: IsAdmin
public static function IsAdmin($userID = 0)
{
if (!is_int($userID)) {
$userID = is_numeric($userID) ? (int) $userID : 0;
}
$result = false;
if ($userID <= 0) {
$user = CCrmSecurityHelper::GetCurrentUser();
$userID = $user->GetID();
if ($userID <= 0) {
false;
}
if (isset(self::$USER_ADMIN_FLAGS[$userID])) {
return self::$USER_ADMIN_FLAGS[$userID];
}
$result = $user->IsAdmin();
if ($result) {
self::$USER_ADMIN_FLAGS[$userID] = true;
return true;
}
try {
if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24') && CModule::IncludeModule('bitrix24')) {
if (class_exists('CBitrix24') && method_exists('CBitrix24', 'IsPortalAdmin')) {
// New style check
$result = CBitrix24::IsPortalAdmin($userID);
} else {
// Check user group 1 ('Portal admins')
$arGroups = $user->GetUserGroup($userID);
$result = in_array(1, $arGroups);
}
}
} catch (Exception $e) {
}
} else {
if (isset(self::$USER_ADMIN_FLAGS[$userID])) {
return self::$USER_ADMIN_FLAGS[$userID];
}
try {
if (IsModuleInstalled('bitrix24') && CModule::IncludeModule('bitrix24') && class_exists('CBitrix24') && method_exists('CBitrix24', 'IsPortalAdmin')) {
// Bitrix24 context new style check
$result = CBitrix24::IsPortalAdmin($userID);
} else {
//Check user group 1 ('Admins')
$user = new CUser();
$arGroups = $user->GetUserGroup($userID);
$result = in_array(1, $arGroups);
}
} catch (Exception $e) {
}
}
self::$USER_ADMIN_FLAGS[$userID] = $result;
return $result;
}
示例7: initDiscountSettings
public static function initDiscountSettings()
{
if (self::$useSaleDiscount === null)
{
self::$useSaleDiscount = ModuleManager::isModuleInstalled('sale') && (string)Option::get('sale', 'use_sale_discount_only') == 'Y';
}
if (self::$getPercentFromBasePrice === null)
{
$moduleID = (self::$useSaleDiscount ? 'sale' : 'catalog');
self::$getPercentFromBasePrice = (string)Option::get($moduleID, 'get_discount_percent_from_base_price') == 'Y';
}
}
示例8: onUserLoginSocserv
public static function onUserLoginSocserv($params)
{
global $USER;
if ($params['EXTERNAL_AUTH_ID'] === \CSocServBitrix24Net::ID && \Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
$notificationOptions = \CUserOptions::getOption("socialservices", "notifications", array());
$lastDate = 0;
if (isset($notificationOptions["CONTACTS_NOTIFY_DATE"])) {
$lastDate = $notificationOptions["CONTACTS_NOTIFY_DATE"];
}
if ($lastDate < time() - 86400) {
static::notifyPossible($USER->getId());
$notificationOptions["CONTACTS_NOTIFY_DATE"] = time();
\CUserOptions::setOption("socialservices", "notifications", $notificationOptions);
}
}
}
示例9: buildSaleAdminMobileMenu
function buildSaleAdminMobileMenu()
{
$items = array(array("text" => GetMessage("SMOB_ALL_ORDERS"), "data-url" => "/bitrix/admin/mobile/sale_orders_list.php", "data-pageid" => "orders_list", "default" => true, "push-param" => "sl"), array("text" => GetMessage("SMOB_WAITING_FOR_PAY"), "data-url" => "/bitrix/admin/mobile/sale_orders_list.php?action=get_filtered&filter_name=waiting_for_pay", "data-pageid" => "orders_waiting_for_pay"), array("text" => GetMessage("SMOB_WAITING_FOR_DELIVERY"), "data-url" => "/bitrix/admin/mobile/sale_orders_list.php?action=get_filtered&filter_name=waiting_for_delivery", "data-pageid" => "orders_waiting_for_delivery"));
if (\Bitrix\Main\ModuleManager::isModuleInstalled("pull")) {
$items[] = array("text" => GetMessage("SMOB_PUSH_SETTINGS"), "data-url" => "/bitrix/admin/mobile/sale_orders_push.php", "data-pageid" => "orders_push");
}
$arMenu = array(array("text" => GetMessage("SMOB_ORDERS_MANAGEMENT"), "type" => "section", "items" => $items));
$arRepMenu = self::getMobileReports();
if ($arRepMenu) {
$arMenu[] = $arRepMenu;
}
$startSortMenuPosition = 200;
foreach ($arMenu as $key => $item) {
$item["sort"] = $key + $startSortMenuPosition;
CAdminMobileMenu::addItem($item);
}
return true;
}
示例10: getModules
public static function getModules()
{
if (!($modules =& self::$modules)) {
$default = array('ACTIVE' => !ModuleManager::isModuleInstalled('sale'));
foreach (array(AttributeManager::getTypesInternal(), CounterManager::getTypesInternal(), RateManager::getTypesInternal()) as $types) {
foreach ($types as $type) {
$modules[$type['MODULE']] = $default;
}
}
if ($modules['sale']) {
$modules['sale']['ACTIVE'] = true;
}
$modules = unserialize(Option::get('conversion', 'MODULES', 'a:0:{}')) + $modules;
// TODO all modules with attributes must be active
$modules['conversion'] = $modules['abtest'] = $modules['sender'] = $modules['seo'] = array('ACTIVE' => true);
ksort($modules);
}
return $modules;
}
示例11: InstallDB
function InstallDB($params = array())
{
global $DB;
if (!$DB->Query("SELECT 'x' FROM b_conv_context", true)) {
Option::set('conversion', 'START_DATE_TIME', date('Y-m-d H:i:s'));
if (ModuleManager::isModuleInstalled('sale') && ($currency = Option::get('sale', 'default_currency'))) {
Option::set('conversion', 'BASE_CURRENCY', $currency);
} elseif (Bitrix\Main\Loader::includeModule('currency')) {
Option::set('conversion', 'BASE_CURRENCY', Bitrix\Currency\CurrencyManager::getBaseCurrency());
}
if ($params['GENERATE_INITIAL_DATA'] !== 'Y') {
Option::set('conversion', 'GENERATE_INITIAL_DATA', 'generated');
}
$DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/conversion/install/db/' . strtolower($DB->type) . '/install.sql');
}
ModuleManager::registerModule('conversion');
RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetCounterTypes');
RegisterModuleDependences('conversion', 'OnGetAttributeTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeTypes');
RegisterModuleDependences('conversion', 'OnGetAttributeGroupTypes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onGetAttributeGroupTypes');
RegisterModuleDependences('conversion', 'OnSetDayContextAttributes', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onSetDayContextAttributes');
RegisterModuleDependences('main', 'OnProlog', 'conversion', '\\Bitrix\\Conversion\\Internals\\Handlers', 'onProlog');
return true;
}
示例12: array
if ($arRecomData['IBLOCK_LINK'] == '') {
$arRecomData['IBLOCK_LINK'] = $arProp['CODE'];
$found = true;
}
} else {
if ($arRecomData['ALL_LINK'] == '') {
$arRecomData['ALL_LINK'] = $arProp['CODE'];
}
}
}
if ($found) {
if (defined("BX_COMP_MANAGED_CACHE")) {
global $CACHE_MANAGER;
$CACHE_MANAGER->StartTagCache("/catalog/recommended");
$CACHE_MANAGER->RegisterTag("iblock_id_" . $arParams["IBLOCK_ID"]);
$CACHE_MANAGER->EndTagCache();
}
}
}
$obCache->EndDataCache($arRecomData);
}
if (!empty($arRecomData) && ($arRecomData['IBLOCK_LINK'] != '' || $arRecomData['ALL_LINK'] != '')) {
$APPLICATION->IncludeComponent("bitrix:catalog.recommended.products", "", array("LINE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"], "TEMPLATE_THEME" => isset($arParams['TEMPLATE_THEME']) ? $arParams['TEMPLATE_THEME'] : '', "ID" => $ElementID, "PROPERTY_LINK" => $arRecomData['IBLOCK_LINK'] != '' ? $arRecomData['IBLOCK_LINK'] : $arRecomData['ALL_LINK'], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "BASKET_URL" => $arParams["BASKET_URL"], "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"], "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"], "PRODUCT_QUANTITY_VARIABLE" => $arParams["PRODUCT_QUANTITY_VARIABLE"], "ADD_PROPERTIES_TO_BASKET" => isset($arParams["ADD_PROPERTIES_TO_BASKET"]) ? $arParams["ADD_PROPERTIES_TO_BASKET"] : '', "PRODUCT_PROPS_VARIABLE" => $arParams["PRODUCT_PROPS_VARIABLE"], "PARTIAL_PRODUCT_PROPERTIES" => isset($arParams["PARTIAL_PRODUCT_PROPERTIES"]) ? $arParams["PARTIAL_PRODUCT_PROPERTIES"] : '', "PAGE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"], "SHOW_OLD_PRICE" => $arParams['SHOW_OLD_PRICE'], "SHOW_DISCOUNT_PERCENT" => $arParams['SHOW_DISCOUNT_PERCENT'], "PRICE_CODE" => $arParams["PRICE_CODE"], "SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"], "PRODUCT_SUBSCRIPTION" => 'N', "PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"], "USE_PRODUCT_QUANTITY" => $arParams['USE_PRODUCT_QUANTITY'], "SHOW_NAME" => "Y", "SHOW_IMAGE" => "Y", "MESS_BTN_BUY" => $arParams['MESS_BTN_BUY'], "MESS_BTN_DETAIL" => $arParams["MESS_BTN_DETAIL"], "MESS_NOT_AVAILABLE" => $arParams['MESS_NOT_AVAILABLE'], "MESS_BTN_SUBSCRIBE" => $arParams['MESS_BTN_SUBSCRIBE'], "SHOW_PRODUCTS_" . $arParams["IBLOCK_ID"] => "Y", "HIDE_NOT_AVAILABLE" => $arParams["HIDE_NOT_AVAILABLE"], "OFFER_TREE_PROPS_" . $arRecomData['OFFER_IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"], "PROPERTY_CODE_" . $arRecomData['OFFER_IBLOCK_ID'] => array(), "CONVERT_CURRENCY" => $arParams['CONVERT_CURRENCY']), $component, array("HIDE_ICONS" => "Y"));
}
if ($arParams["USE_ALSO_BUY"] == "Y" && \Bitrix\Main\ModuleManager::isModuleInstalled("sale") && !empty($arRecomData)) {
$APPLICATION->IncludeComponent("bitrix:sale.recommended.products", ".default", array("ID" => $ElementID, "TEMPLATE_THEME" => isset($arParams['TEMPLATE_THEME']) ? $arParams['TEMPLATE_THEME'] : '', "MIN_BUYES" => $arParams["ALSO_BUY_MIN_BUYES"], "ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"], "LINE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"], "DETAIL_URL" => $arParams["DETAIL_URL"], "BASKET_URL" => $arParams["BASKET_URL"], "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"], "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"], "SECTION_ID_VARIABLE" => $arParams["SECTION_ID_VARIABLE"], "PAGE_ELEMENT_COUNT" => $arParams["ALSO_BUY_ELEMENT_COUNT"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "PRICE_CODE" => $arParams["PRICE_CODE"], "USE_PRICE_COUNT" => $arParams["USE_PRICE_COUNT"], "SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"], "PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"], 'CONVERT_CURRENCY' => $arParams['CONVERT_CURRENCY'], 'CURRENCY_ID' => $arParams['CURRENCY_ID'], 'HIDE_NOT_AVAILABLE' => $arParams["HIDE_NOT_AVAILABLE"], "SHOW_PRODUCTS_" . $arParams["IBLOCK_ID"] => "Y", "PROPERTY_CODE_" . $arRecomData['OFFER_IBLOCK_ID'] => array(), "OFFER_TREE_PROPS_" . $arRecomData['OFFER_IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"]), $component);
}
if ($arParams["USE_STORE"] == "Y" && \Bitrix\Main\ModuleManager::isModuleInstalled("catalog")) {
$APPLICATION->IncludeComponent("bitrix:catalog.store.amount", ".default", array("PER_PAGE" => "10", "USE_STORE_PHONE" => $arParams["USE_STORE_PHONE"], "SCHEDULE" => $arParams["USE_STORE_SCHEDULE"], "USE_MIN_AMOUNT" => $arParams["USE_MIN_AMOUNT"], "MIN_AMOUNT" => $arParams["MIN_AMOUNT"], "ELEMENT_ID" => $ElementID, "STORE_PATH" => $arParams["STORE_PATH"], "MAIN_TITLE" => $arParams["MAIN_TITLE"]), $component);
}
}
示例13: array
if (is_array($item)) {
$keys = array();
foreach ($item as $fld => $value) {
$keys[] = $fld;
}
foreach ($keys as $key) {
if (!isset($item['~' . $key])) {
$item['~' . $key] = $item[$key];
}
}
$item['IS_COMPLETE'] = $item['CHECKED'] == '1' ? 'Y' : 'N';
if (!isset($item['ID'])) {
$item['ID'] = 'task-detail-checklist-item-xxx_' . rand(0, 999999);
}
// newly created item, ID should be defined anyway
}
}
}
$arResult['RESPONSIBLE_NAME_FORMATTED'] = $arResult['DATA']["RESPONSIBLE_NAME"] || $arResult['DATA']["RESPONSIBLE_LAST_NAME"] || $arResult['DATA']["RESPONSIBLE_LOGIN"] ? CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arResult['DATA']["RESPONSIBLE_NAME"], "LAST_NAME" => $arResult['DATA']["RESPONSIBLE_LAST_NAME"], "LOGIN" => $arResult['DATA']["RESPONSIBLE_LOGIN"], "SECOND_NAME" => $arResult['DATA']["RESPONSIBLE_SECOND_NAME"]), true, false) : "";
$arResult['CREATED_BY_NAME_FORMATTED'] = $arResult['DATA']["CREATED_BY_NAME"] || $arResult['DATA']["CREATED_BY_LAST_NAME"] || $arResult['DATA']["CREATED_BY_LOGIN"] ? CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arResult['DATA']["CREATED_BY_NAME"], "LAST_NAME" => $arResult['DATA']["CREATED_BY_LAST_NAME"], "LOGIN" => $arResult['DATA']["CREATED_BY_LOGIN"], "SECOND_NAME" => $arResult['DATA']["CREATED_BY_SECOND_NAME"]), true, false) : "";
$arResult['USER_CREATE_TEMPLATE'] = $arResult['DATA']['TPARAM_TYPE'] == CTaskTemplates::TYPE_FOR_NEW_USER;
$arResult['CSS_MODES'] = array();
if (intval($arResult['DATA']['BASE_TEMPLATE_ID'])) {
$arResult['CSS_MODES'][] = 'state-base-template-choosen';
}
if ($arResult['USER_CREATE_TEMPLATE']) {
$arResult['CSS_MODES'][] = 'state-user-create-template';
}
$arResult['RESPONSIBLE_DISABLED'] = $arResult['DATA']["CREATED_BY"] != $USER->GetID() || $arResult['USER_CREATE_TEMPLATE'];
$arResult['BX24_MODE'] = \Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24');
示例14: array
<?php
use Bitrix\Main\ModuleManager;
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
die;
}
$arThemes = array();
if (ModuleManager::isModuleInstalled('bitrix.eshop')) {
$arThemes['site'] = GetMessage('CP_BCC_TPL_THEME_SITE');
}
$arThemesList = array('blue' => GetMessage('CP_BCC_TPL_THEME_BLUE'), 'green' => GetMessage('CP_BCC_TPL_THEME_GREEN'), 'red' => GetMessage('CP_BCC_TPL_THEME_RED'), 'wood' => GetMessage('CP_BCC_TPL_THEME_WOOD'), 'yellow' => GetMessage('CP_BCC_TPL_THEME_YELLOW'), 'black' => GetMessage('CP_BCC_TPL_THEME_BLACK'));
$dir = trim(preg_replace("'[\\\\/]+'", "/", dirname(__FILE__) . "/themes/"));
if (is_dir($dir)) {
foreach ($arThemesList as $themeID => $themeName) {
if (!is_file($dir . $themeID . '/style.css')) {
continue;
}
$arThemes[$themeID] = $themeName;
}
}
$arTemplateParameters['TEMPLATE_THEME'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage("CP_BCC_TPL_TEMPLATE_THEME"), 'TYPE' => 'LIST', 'VALUES' => $arThemes, 'DEFAULT' => 'blue', 'ADDITIONAL_VALUES' => 'Y');
示例15: InstallDB
//.........这里部分代码省略.........
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlGroup", "GetControlDescr", 100);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlDelivery", "GetControlDescr", 200);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlBasketGroup", "GetControlDescr", 300);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCtrlSubGroup", "GetControlDescr", 1000);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "sale", "CSaleActionCondCtrlBasketFields", "GetControlDescr", 1100);
//pulling for mobile orders
RegisterModuleDependences("sale", "OnOrderDelete", "sale", "CSaleMobileOrderPull", "onOrderDelete", 100);
RegisterModuleDependences("sale", "OnOrderAdd", "sale", "CSaleMobileOrderPull", "onOrderAdd", 100);
RegisterModuleDependences("sale", "OnOrderUpdate", "sale", "CSaleMobileOrderPull", "onOrderUpdate", 100);
// sale product2product
RegisterModuleDependences("sale", "OnBasketOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleOrderAdd", 100);
RegisterModuleDependences("sale", "OnSaleStatusOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleStatusOrderHandler", 100);
RegisterModuleDependences("sale", "OnSaleDeliveryOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeliveryOrderHandler", 100);
RegisterModuleDependences("sale", "OnSaleDeductOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleDeductOrderHandler", 100);
RegisterModuleDependences("sale", "OnSaleCancelOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSaleCancelOrderHandler", 100);
RegisterModuleDependences("sale", "OnSalePayOrder", "sale", "\\Bitrix\\Sale\\Product2ProductTable", "onSalePayOrderHandler", 100);
CAgent::AddAgent("\\Bitrix\\Sale\\Product2ProductTable::deleteOldProducts(10);", "sale", "N", 10 * 24 * 3600, "", "Y");
// conversion
RegisterModuleDependences('conversion', 'OnGetCounterTypes', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onGetCounterTypes');
RegisterModuleDependences('conversion', 'OnGetRateTypes', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onGetRateTypes');
RegisterModuleDependences('conversion', 'OnGenerateInitialData', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onGenerateInitialData');
RegisterModuleDependences('sale', 'OnBeforeBasketAdd', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBeforeBasketAdd');
RegisterModuleDependences('sale', 'OnBasketAdd', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBasketAdd');
RegisterModuleDependences('sale', 'OnBeforeBasketUpdate', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBeforeBasketUpdate');
RegisterModuleDependences('sale', 'OnBasketUpdate', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBasketUpdate');
RegisterModuleDependences('sale', 'OnBeforeBasketDelete', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBeforeBasketDelete');
RegisterModuleDependences('sale', 'OnBasketDelete', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onBasketDelete');
RegisterModuleDependences('sale', 'OnOrderAdd', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onOrderAdd');
RegisterModuleDependences('sale', 'OnSalePayOrder', 'sale', '\\Bitrix\\Sale\\Internals\\ConversionHandlers', 'onSalePayOrder');
RegisterModuleDependences("perfmon", "OnGetTableSchema", "sale", "sale", "OnGetTableSchema");
COption::SetOptionString("sale", "viewed_capability", "N");
COption::SetOptionString("sale", "viewed_count", 10);
COption::SetOptionString("sale", "viewed_time", 5);
COption::SetOptionString("main", "~sale_converted_15", 'Y');
COption::SetOptionString("sale", "expiration_processing_events", 'N');
COption::SetOptionString("sale", "p2p_status_list", serialize(array("N", "P", "F", "F_CANCELED", "F_DELIVERY", "F_PAY", "F_OUT")));
if ($clearInstall) {
\Bitrix\Main\Config\Option::set('sale', 'basket_discount_converted', 'Y', '');
}
CAgent::AddAgent("CSaleRecurring::AgentCheckRecurring();", "sale", "N", 7200, "", "Y");
CAgent::AddAgent("CSaleOrder::RemindPayment();", "sale", "N", 86400, "", "Y");
CAgent::AddAgent("CSaleViewedProduct::ClearViewed();", "sale", "N", 86400, "", "Y");
CAgent::AddAgent("CSaleOrder::ClearProductReservedQuantity();", "sale", "N", 86400, "", "Y");
COption::SetOptionString("sale", "product_reserve_clear_period", "3");
\Bitrix\Main\Config\Option::set('sale', 'sale_locationpro_import_performed', 'Y');
// install tasks + operations for statuses
$operations = array();
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_view'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_cancel'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_mark'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_delivery'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_deduction'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_payment'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_to'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_update'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_delete'));
$operations[] = Bitrix\Main\OperationTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_from'));
Bitrix\Main\TaskTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_none', 'SYS' => 'Y', 'LETTER' => 'D'));
$result = Bitrix\Main\TaskTable::add(array('MODULE_ID' => 'sale', 'BINDING' => 'status', 'NAME' => 'sale_status_all', 'SYS' => 'Y', 'LETTER' => 'X'));
if ($result->isSuccess()) {
$taskId = $result->getId();
foreach ($operations as $result) {
if ($result->isSuccess()) {
Bitrix\Main\TaskOperationTable::add(array('TASK_ID' => $taskId, 'OPERATION_ID' => $result->getId()));
}
}
}
if (Bitrix\Main\Loader::IncludeModule('sale')) {
// install statuses
$orderInitialStatus = Bitrix\Sale\OrderStatus::getInitialStatus();
$orderFinalStatus = Bitrix\Sale\OrderStatus::getFinalStatus();
$deliveryInitialStatus = Bitrix\Sale\DeliveryStatus::getInitialStatus();
$deliveryFinalStatus = Bitrix\Sale\DeliveryStatus::getFinalStatus();
$statusLanguages = array();
$result = Bitrix\Main\Localization\LanguageTable::getList(array('select' => array('LID'), 'filter' => array('=ACTIVE' => 'Y')));
while ($row = $result->Fetch()) {
$languageId = $row['LID'];
Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/sale/lib/status.php', $languageId);
foreach (array($orderInitialStatus, $orderFinalStatus, $deliveryInitialStatus, $deliveryFinalStatus) as $statusId) {
if ($statusName = Bitrix\Main\Localization\Loc::getMessage("SALE_STATUS_{$statusId}")) {
$statusLanguages[$statusId][] = array('LID' => $languageId, 'NAME' => $statusName, 'DESCRIPTION' => Bitrix\Main\Localization\Loc::getMessage("SALE_STATUS_{$statusId}_DESCR"));
}
}
}
Bitrix\Sale\OrderStatus::install(array('ID' => $orderInitialStatus, 'SORT' => 100, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$orderInitialStatus]));
Bitrix\Sale\OrderStatus::install(array('ID' => $orderFinalStatus, 'SORT' => 200, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$orderFinalStatus]));
Bitrix\Sale\DeliveryStatus::install(array('ID' => $deliveryInitialStatus, 'SORT' => 300, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$deliveryInitialStatus]));
Bitrix\Sale\DeliveryStatus::install(array('ID' => $deliveryFinalStatus, 'SORT' => 400, 'NOTIFY' => 'Y', 'LANG' => $statusLanguages[$deliveryFinalStatus]));
// enabling location pro
COption::SetOptionString("sale", "sale_locationpro_migrated", "Y");
COption::SetOptionString("sale", "sale_locationpro_enabled", "Y");
if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
// this will create at least base types if we are at Bitrix24
include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/sale/lib/location/migration/migrate.php";
\Bitrix\Sale\Location\Migration\CUpdaterLocationPro::createBaseTypes();
}
CSaleYMHandler::install();
}
return true;
}