Beispiel #1
0
 /**
  * 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);
 }
 /**
  * {@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;
 }
 /**
  * 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);
 }
Beispiel #4
0
 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);
 }
 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();
 }
Beispiel #6
0
 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;
 }
	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';
		}
	}
Beispiel #8
0
 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);
         }
     }
 }
Beispiel #9
0
 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;
 }
Beispiel #10
0
 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;
 }
Beispiel #11
0
 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;
 }
Beispiel #12
0
                    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);
    }
}
Beispiel #13
0
        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');
Beispiel #14
0
<?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');
Beispiel #15
0
 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     $clearInstall = false;
     if (!$DB->Query("SELECT 'x' FROM b_sale_basket", true)) {
         $clearInstall = true;
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     ModuleManager::registerModule('sale');
     $eventManager = \Bitrix\Main\EventManager::getInstance();
     $eventManager->registerEventHandlerCompatible('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout');
     RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin");
     RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout");
     RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php");
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale");
     RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount");
     RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu");
     RegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer");
     RegisterModuleDependences("sender", "OnTriggerList", "sale", "\\Bitrix\\Sale\\Sender\\EventHandler", "onTriggerList");
     RegisterModuleDependences("sender", "OnPresetMailingList", "sale", "\\Bitrix\\Sale\\Sender\\EventHandler", "onPresetMailingList");
     RegisterModuleDependences("sender", "OnPresetTemplateList", "sale", "\\Bitrix\\Sale\\Sender\\EventHandler", "onPresetTemplateList");
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000);
     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;
 }
Beispiel #16
0
					<span class="site-speed-stat-value" id="site-speed-composite"></span>
				</div>
			</div>

			<div class="site-speed-explanation">
				<b><?php 
echo Loc::getMessage("MAIN_SITE_SPEED_TITLE");
?>
</b> &mdash; <?php 
echo Loc::getMessage("MAIN_SITE_SPEED_TITLE_DESC");
?>
			</div>

			<div class="site-speed-perf" id="site-speed-perf">
				<?php 
if (\Bitrix\Main\ModuleManager::isModuleInstalled("perfmon")) {
    $mark = (double) COption::GetOptionString("perfmon", "mark_php_page_rate", "");
    ?>
					<a href="/bitrix/admin/perfmon_panel.php?lang=<?php 
    echo LANGUAGE_ID;
    ?>
" class="site-speed-perf-label"><?php 
    echo Loc::getMessage("MAIN_SITE_SPEED_PERF");
    ?>
</a>:<span class="site-speed-perf-value"><?php 
    if ($mark > 0) {
        echo $mark;
    } else {
        echo Loc::getMessage("MAIN_SITE_SPEED_PERF_NO_RES");
    }
    ?>
$message = null;

try
{
	$currentUser = $engine->getCurrentUser();
}
catch(Exception $e)
{
	$currentUser = null;
	$bNeedAuth = true;
}

$bReadOnly = $bNeedAuth;
$bAllowUpdate = !$bNeedAuth;
$bSale = Main\ModuleManager::isModuleInstalled('sale')
	&& Main\ModuleManager::isModuleInstalled('catalog')
	&& Main\Loader::includeModule('currency');

$request = Main\Context::getCurrent()->getRequest();

$back_url = isset($request["back_url"]) ? $request["back_url"] : '';

$campaignId = intval($request["campaign"]);
$elementId = intval($request["element"]);
$ID = intval($request["ID"]);

if($ID > 0)
{
	$dbRes = Adv\YandexBannerTable::getByPrimary($ID);
	$banner = $dbRes->fetch();
	if($banner)
Beispiel #18
0
 function InstallDB()
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     if (!$DB->Query("SELECT 'x' FROM b_sale_basket", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("", $this->errors));
         return false;
     }
     ModuleManager::registerModule('sale');
     $eventManager = \Bitrix\Main\EventManager::getInstance();
     $eventManager->registerEventHandlerCompatible('main', 'OnUserLogout', 'sale', '\\Bitrix\\Sale\\DiscountCouponsManager', 'logout');
     RegisterModuleDependences("main", "OnUserLogin", "sale", "CSaleUser", "OnUserLogin");
     RegisterModuleDependences("main", "OnUserLogout", "sale", "CSaleUser", "OnUserLogout");
     RegisterModuleDependences("main", "OnBeforeLangDelete", "sale", "CSalePersonType", "OnBeforeLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocation", "OnLangDelete");
     RegisterModuleDependences("main", "OnLanguageDelete", "sale", "CSaleLocationGroup", "OnLangDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleOrderUserProps", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserAccount", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleAuxiliary", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUser", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleRecurring", "OnUserDelete");
     RegisterModuleDependences("main", "OnUserDelete", "sale", "CSaleUserCards", "OnUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleOrder", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleAffiliate", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeUserDelete", "sale", "CSaleUserAccount", "OnBeforeUserDelete");
     RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 100, "/modules/sale/affiliate.php");
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSaleYMHandler", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "sale", "CSalePaySystemAction", 'OnEventLogGetAuditTypes');
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleOrder", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnBeforeCurrencyDelete", "sale", "CSaleLang", "OnBeforeCurrencyDelete");
     RegisterModuleDependences("currency", "OnModuleUnInstall", "sale", "", "CurrencyModuleUnInstallSale");
     RegisterModuleDependences("catalog", "OnSaleOrderSumm", "sale", "CSaleOrder", "__SaleOrderCount");
     RegisterModuleDependences("mobileapp", "OnBeforeAdminMobileMenuBuild", "sale", "CSaleMobileOrderUtils", "buildSaleAdminMobileMenu");
     RegisterModuleDependences("sender", "OnConnectorList", "sale", "\\Bitrix\\Sale\\SenderEventHandler", "onConnectorListBuyer");
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketGroup", "GetControlDescr", 200);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlBasketFields", "GetControlDescr", 300);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlOrderFields", "GetControlDescr", 1000);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "sale", "CSaleCondCtrlCommon", "GetControlDescr", 10000);
     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");
     COption::SetOptionString("sale", "viewed_capability", "N");
     COption::SetOptionString("sale", "viewed_count", 10);
     COption::SetOptionString("sale", "viewed_time", 5);
     COption::SetOptionString("sale", "p2p_status_list", serialize(array("N", "P", "F", "F_CANCELED", "F_DELIVERY", "F_PAY", "F_OUT")));
     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", 259200, "", "Y");
     COption::SetOptionString("sale", "product_reserve_clear_period", "3");
     if (CModule::IncludeModule("sale")) {
         $dbStatusList = CSaleStatus::GetList(array(), array(), false, false, array());
         if (!($arStatusList = $dbStatusList->Fetch())) {
             $arLandDataN = array();
             $arLandDataF = array();
             $languageIterator = LanguageTable::getList(array('select' => array('ID'), 'filter' => array('=ACTIVE' => 'Y')));
             while ($language = $languageIterator->fetch()) {
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sale/status.php", $language['ID']);
                 $arLandDataN[] = array("LID" => $language['ID'], "NAME" => GetMessage("SIM_ACCEPTED"), "DESCRIPTION" => GetMessage("SIM_ACCEPTED_DESCR"));
                 $arLandDataF[] = array("LID" => $language['ID'], "NAME" => GetMessage("SIM_FINISHED"), "DESCRIPTION" => GetMessage("SIM_FINISHED_DESCR"));
             }
             unset($language, $languageIterator);
             CSaleStatus::Add(array("ID" => "N", "SORT" => 100, "LANG" => $arLandDataN));
             CSaleStatus::Add(array("ID" => "F", "SORT" => 200, "LANG" => $arLandDataF));
         }
         // 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;
 }
Beispiel #19
0
 function InstallDB()
 {
     global $APPLICATION;
     global $DB;
     global $errors;
     $bitrix24 = ModuleManager::isModuleInstalled('bitrix24');
     if (!$DB->Query("SELECT 'x' FROM b_catalog_group", true)) {
         $errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/db/" . strtolower($DB->type) . "/install.sql");
     }
     if (!empty($errors)) {
         $APPLICATION->ThrowException(implode("", $errors));
         return false;
     }
     ModuleManager::registerModule('catalog');
     $eventManager = \Bitrix\Main\EventManager::getInstance();
     $eventManager->registerEventHandler('sale', 'onBuildCouponProviders', 'catalog', '\\Bitrix\\Catalog\\DiscountCouponTable', 'couponManager');
     RegisterModuleDependences("iblock", "OnIBlockDelete", "catalog", "CCatalog", "OnIBlockDelete");
     RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogProduct", "OnIBlockElementDelete");
     RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CPrice", "OnIBlockElementDelete");
     RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogStoreProduct", "OnIBlockElementDelete");
     RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogDocs", "OnIBlockElementDelete");
     RegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalogDocs", "OnBeforeIBlockElementDelete");
     RegisterModuleDependences("currency", "OnCurrencyDelete", "catalog", "CPrice", "OnCurrencyDelete");
     RegisterModuleDependences("main", "OnGroupDelete", "catalog", "CCatalogProductGroups", "OnGroupDelete");
     RegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "catalog", "CCatalogProduct", "OnAfterIBlockElementUpdate");
     RegisterModuleDependences("currency", "OnModuleUnInstall", "catalog", "", "CurrencyModuleUnInstallCatalog");
     RegisterModuleDependences("iblock", "OnBeforeIBlockDelete", "catalog", "CCatalog", "OnBeforeCatalogDelete", 300);
     RegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalog", "OnBeforeIBlockElementDelete", 10000);
     RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "catalog", "CCatalogEvent", "GetAuditTypes");
     RegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildGlobalMenu');
     RegisterModuleDependences('main', 'OnAdminListDisplay', 'catalog', 'CCatalogAdmin', 'OnAdminListDisplay');
     RegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildSaleMenu');
     RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlGroup", "GetControlDescr", 100);
     RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockFields", "GetControlDescr", 200);
     RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockProps", "GetControlDescr", 300);
     RegisterModuleDependences("catalog", "OnDocumentBarcodeDelete", "catalog", "CCatalogStoreDocsElement", "OnDocumentBarcodeDelete");
     RegisterModuleDependences("catalog", "OnBeforeDocumentDelete", "catalog", "CCatalogStoreDocsBarcode", "OnBeforeDocumentDelete");
     RegisterModuleDependences("catalog", "OnCatalogStoreDelete", "catalog", "CCatalogDocs", "OnCatalogStoreDelete");
     RegisterModuleDependences("iblock", "OnBeforeIBlockPropertyDelete", "catalog", "CCatalog", "OnBeforeIBlockPropertyDelete");
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductFields", "GetControlDescr", 1100);
     RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductProps", "GetControlDescr", 1200);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductFields", "GetControlDescr", 1200);
     RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductProps", "GetControlDescr", 1300);
     RegisterModuleDependences("sale", "OnExtendBasketItems", "catalog", "CCatalogDiscount", "ExtendBasketItems", 100);
     RegisterModuleDependences('iblock', 'OnModuleUnInstall', 'catalog', 'CCatalog', 'OnIBlockModuleUnInstall');
     if (!$bitrix24) {
         CAgent::AddAgent('\\Bitrix\\Catalog\\CatalogViewedProductTable::clearAgent();', 'catalog', 'N', (int) COption::GetOptionString("catalog", "viewed_period") * 24 * 3600);
     }
     $this->InstallTasks();
     $arCount = $DB->Query("select count(ID) as COUNT from b_catalog_measure", true)->Fetch();
     if (is_array($arCount) && isset($arCount['COUNT']) && intval($arCount['COUNT']) <= 0) {
         $DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(6, 'm', 'MTR', 'N')", true);
         $DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(112, 'l', 'LTR', 'N')", true);
         $DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(163, 'g', 'GRM', 'N')", true);
         $DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(166, 'kg', 'KGM', 'N')", true);
         $DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(796, 'pc. 1', 'PCE. NMB', 'Y')", true);
     }
     if (!$bitrix24) {
         $languageID = '';
         $siteIterator = SiteTable::getList(array('select' => array('LID', 'LANGUAGE_ID'), 'filter' => array('=DEF' => 'Y', '=ACTIVE' => 'Y')));
         if ($site = $siteIterator->fetch()) {
             $languageID = (string) $site['LANGUAGE_ID'];
         }
         if ($languageID == '') {
             $languageID = 'en';
         }
         if ($languageID == 'ru') {
             $mess = Loc::getMessage('CATALOG_INSTALL_PROFILE_IRR2', null, 'ru');
             if ($mess == '') {
                 $mess = 'irr.ru';
             }
             $strQuery = "select COUNT(CE.ID) as CNT from b_catalog_export CE where CE.IS_EXPORT = 'Y' and CE.FILE_NAME ='yandex' and CE.NAME = '" . $DB->ForSql($mess) . "'";
             $rsProfiles = $DB->Query($strQuery, true);
             if (false !== $rsProfiles) {
                 $arProfile = $rsProfiles->Fetch();
                 if ((int) $arProfile['CNT'] == 0) {
                     $arFields = array('FILE_NAME' => 'yandex', 'NAME' => $mess, 'DEFAULT_PROFILE' => 'N', 'IN_MENU' => 'N', 'IN_AGENT' => 'N', 'IN_CRON' => 'N', 'NEED_EDIT' => 'Y', 'IS_EXPORT' => 'Y');
                     $arInsert = $DB->PrepareInsert("b_catalog_export", $arFields);
                     $strQuery = "INSERT INTO b_catalog_export(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
                     $DB->Query($strQuery, true);
                 }
             }
         }
     }
     return true;
 }
 /**
  * <p>Метод помогает компонентам показать значения свойства элемента. Вынесен в модуль для унификации отображения. Метод статический.</p>
  *
  *
  * @param array $arItem  Массив полей элемента.
  *
  * @param array $arProperty  Массив полей свойства (как его возвращает метод <a
  * href="http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockelement/getproperty.php">CIBlockElement::GetProperty</a>).
  *
  * @param string $event1  Метка для создания события перехода по ссылке в случае, когда
  * установлен модуль <b>Веб-аналитика</b>.
  *
  * @return array <p>Массив полей элемента.</p> <p></p><div class="note"> <b>Примечание:</b> метод в
  * поле DISPLAY_VALUE выводит только активные по дате элементы
  * (используется фильтр на уровне ядра, поэтому вывести ссылки на
  * неактивные элементы не получится стандартными средствами). </div>
  * <br><br>
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/iblock/classes/ciblockformatproperties/getdisplayvalue.php
  * @author Bitrix
  */
 public static function GetDisplayValue($arItem, $arProperty, $event1)
 {
     static $installedStatictic = null;
     if (null === $installedStatictic) {
         $installedStatictic = \Bitrix\Main\ModuleManager::isModuleInstalled('statistic');
     }
     $arUserTypeFormat = false;
     if (isset($arProperty["USER_TYPE"]) && !empty($arProperty["USER_TYPE"])) {
         $arUserType = CIBlockProperty::GetUserType($arProperty["USER_TYPE"]);
         if (isset($arUserType["GetPublicViewHTML"])) {
             $arUserTypeFormat = $arUserType["GetPublicViewHTML"];
         }
     }
     static $CACHE = array("E" => array(), "G" => array());
     if ($arUserTypeFormat) {
         if ($arProperty["MULTIPLE"] == "N" || !is_array($arProperty["~VALUE"])) {
             $arValues = array($arProperty["~VALUE"]);
         } else {
             $arValues = $arProperty["~VALUE"];
         }
     } else {
         if (is_array($arProperty["VALUE"])) {
             $arValues = $arProperty["VALUE"];
         } else {
             $arValues = array($arProperty["VALUE"]);
         }
     }
     $arDisplayValue = array();
     $arFiles = array();
     $arLinkElements = array();
     $arLinkSections = array();
     foreach ($arValues as $val) {
         if ($arUserTypeFormat) {
             $arDisplayValue[] = call_user_func_array($arUserTypeFormat, array($arProperty, array("VALUE" => $val), array()));
         } elseif ($arProperty["PROPERTY_TYPE"] == "E") {
             if (intval($val) > 0) {
                 if (!isset($CACHE["E"][$val])) {
                     //USED TO GET "LINKED" ELEMENTS
                     $arLinkFilter = array("ID" => $val, "ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y");
                     $rsLink = CIBlockElement::GetList(array(), $arLinkFilter, false, false, array("ID", "IBLOCK_ID", "NAME", "DETAIL_PAGE_URL", "PREVIEW_PICTURE", "DETAIL_PICTURE"));
                     $CACHE["E"][$val] = $rsLink->GetNext();
                 }
                 if (is_array($CACHE["E"][$val])) {
                     $arDisplayValue[] = '<a href="' . $CACHE["E"][$val]["DETAIL_PAGE_URL"] . '">' . $CACHE["E"][$val]["NAME"] . '</a>';
                     $arLinkElements[$val] = $CACHE["E"][$val];
                 }
             }
         } elseif ($arProperty["PROPERTY_TYPE"] == "G") {
             if (intval($val) > 0) {
                 if (!isset($CACHE["G"][$val])) {
                     //USED TO GET SECTIONS NAMES
                     $arSectionFilter = array("ID" => $val);
                     $rsSection = CIBlockSection::GetList(array(), $arSectionFilter, false, array("ID", "IBLOCK_ID", "NAME", "SECTION_PAGE_URL", "PICTURE", "DETAIL_PICTURE"));
                     $CACHE["G"][$val] = $rsSection->GetNext();
                 }
                 if (is_array($CACHE["G"][$val])) {
                     $arDisplayValue[] = '<a href="' . $CACHE["G"][$val]["SECTION_PAGE_URL"] . '">' . $CACHE["G"][$val]["NAME"] . '</a>';
                     $arLinkSections[$val] = $CACHE["G"][$val];
                 }
             }
         } elseif ($arProperty["PROPERTY_TYPE"] == "L") {
             $arDisplayValue[] = $val;
         } elseif ($arProperty["PROPERTY_TYPE"] == "F") {
             if ($arFile = CFile::GetFileArray($val)) {
                 $arFiles[] = $arFile;
                 if ($installedStatictic) {
                     $arDisplayValue[] = '<a href="' . htmlspecialcharsbx("/bitrix/redirect.php?event1=" . urlencode($event1) . "&event2=" . urlencode($arFile["SRC"]) . "&event3=" . urlencode($arFile["ORIGINAL_NAME"]) . "&goto=" . urlencode($arFile["SRC"])) . '">' . GetMessage('IBLOCK_DOWNLOAD') . '</a>';
                 } else {
                     $arDisplayValue[] = '<a href="' . htmlspecialcharsbx($arFile["SRC"]) . '">' . GetMessage('IBLOCK_DOWNLOAD') . '</a>';
                 }
             }
         } else {
             $trimmed = trim($val);
             if (strpos($trimmed, "http") === 0) {
                 if ($installedStatictic) {
                     $arDisplayValue[] = '<a href="' . htmlspecialcharsbx("/bitrix/redirect.php?event1=" . urlencode($event1) . "&event2=" . urlencode($trimmed) . "&event3=" . urlencode($arItem["NAME"]) . "&goto=" . urlencode($trimmed)) . '">' . $trimmed . '</a>';
                 } else {
                     $arDisplayValue[] = '<a href="' . htmlspecialcharsbx($trimmed) . '">' . $trimmed . '</a>';
                 }
             } elseif (strpos($trimmed, "www") === 0) {
                 if ($installedStatictic) {
                     $arDisplayValue[] = '<a href="' . htmlspecialcharsbx("/bitrix/redirect.php?event1=" . urlencode($event1) . "&event2=" . urlencode("http://" . $trimmed) . "&event3=" . urlencode($arItem["NAME"]) . "&goto=" . urlencode("http://" . $trimmed)) . '">' . $trimmed . '</a>';
                 } else {
                     $arDisplayValue[] = '<a href="' . htmlspecialcharsbx("http://" . $trimmed) . '">' . $trimmed . '</a>';
                 }
             } else {
                 $arDisplayValue[] = $val;
             }
         }
     }
     $displayCount = count($arDisplayValue);
     if ($displayCount == 1) {
         $arProperty["DISPLAY_VALUE"] = $arDisplayValue[0];
     } elseif ($displayCount > 1) {
         $arProperty["DISPLAY_VALUE"] = $arDisplayValue;
     } else {
         $arProperty["DISPLAY_VALUE"] = false;
     }
     if ($arProperty["PROPERTY_TYPE"] == "F") {
         $fileCount = count($arFiles);
         if ($fileCount == 1) {
             $arProperty["FILE_VALUE"] = $arFiles[0];
         } elseif ($fileCount > 1) {
             $arProperty["FILE_VALUE"] = $arFiles;
         } else {
             $arProperty["FILE_VALUE"] = false;
         }
     } elseif ($arProperty['PROPERTY_TYPE'] == 'E') {
         $arProperty['LINK_ELEMENT_VALUE'] = !empty($arLinkElements) ? $arLinkElements : false;
     } elseif ($arProperty['PROPERTY_TYPE'] == 'G') {
         $arProperty['LINK_SECTION_VALUE'] = !empty($arLinkSections) ? $arLinkSections : false;
     }
     return $arProperty;
 }
Beispiel #21
0
    echo GetMessage("MAIN_HINT_RESTORE_DEFAULTS");
    ?>
" OnClick="RestoreDefaults();" value="<?php 
    echo GetMessage("MAIN_RESTORE_DEFAULTS");
    ?>
">
<?php 
    $tabControl->End();
    ?>
</form>
<h2><?php 
    echo GetMessage("SALE_SYSTEM_PROCEDURES");
    ?>
</h2>
	<?php 
    $showbasketDiscountConvert = (string) Main\Config\Option::get('sale', 'basket_discount_converted') != 'Y' && Main\ModuleManager::isModuleInstalled('catalog');
    $systemTabs[] = array('DIV' => 'saleSysTabReindex', 'TAB' => GetMessage('SALE_SYSTEM_TAB_REINDEX'), 'ICON' => 'sale_settings', 'TITLE' => GetMessage('SALE_SYSTEM_TAB_REINDEX_TITLE'));
    if ($showbasketDiscountConvert) {
        $systemTabs[] = array('DIV' => 'saleSysTabConvert', 'TAB' => GetMessage('SALE_SYSTEM_TAB_CONVERT'), 'ICON' => 'sale_settings', 'TITLE' => GetMessage('SALE_SYSTEM_TAB_CONVERT_TITLE'));
    }
    $systemTabControl = new CAdminTabControl('saleSysTabControl', $systemTabs, true, true);
    $systemTabControl->Begin();
    $systemTabControl->BeginNextTab();
    ?>
<tr><td align="left"><?php 
    $firstTop = ' style="margin-top: 0;"';
    ?>
<h4<?php 
    echo $firstTop;
    ?>
><?php 
Beispiel #22
0
				"HIDE_NOT_AVAILABLE" => $arParams["HIDE_NOT_AVAILABLE"],
				"OFFER_TREE_PROPS_".$arRecomData['OFFER_IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"],
				"OFFER_TREE_PROPS_".$arRecomData['OFFER_IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"],
				"ADDITIONAL_PICT_PROP_".$arParams['IBLOCK_ID'] => $arParams['ADD_PICT_PROP'],
				"ADDITIONAL_PICT_PROP_".$arRecomData['OFFER_IBLOCK_ID'] => $arParams['OFFER_ADD_PICT_PROP'],
				"PROPERTY_CODE_".$arRecomData['OFFER_IBLOCK_ID'] => array(),
				"CONVERT_CURRENCY" => $arParams["CONVERT_CURRENCY"],
				"CURRENCY_ID" => $arParams["CURRENCY_ID"]
			),
			$component
		);
	?><?
		}
	}

	if($arParams["USE_ALSO_BUY"] == "Y" && 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"],
Beispiel #23
0
use Bitrix\Main\Loader;
use Bitrix\Main\ModuleManager;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\Config\Option;
use Bitrix\Currency\CurrencyTable;

define('CATALOG_NEW_OFFERS_IBLOCK_NEED','-1');

$bReadOnly = !$USER->CanDoOperation('catalog_settings');
if ($USER->CanDoOperation('catalog_read') || !$bReadOnly)
{
	Loader::includeModule('catalog');
	Loc::loadMessages(__FILE__);

	$useSaleDiscountOnly = false;
	$saleIsInstalled = ModuleManager::isModuleInstalled('sale');
	if ($saleIsInstalled)
	{
		$useSaleDiscountOnly = (string)Option::get('sale', 'use_sale_discount_only') == 'Y';
	}

	$applyDiscSaveModeList = CCatalogDiscountSave::GetApplyModeList(true);

	if ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty($_REQUEST['RestoreDefaults']) && !$bReadOnly && check_bitrix_sessid())
	{
		if (!$USER->IsAdmin())
			$strValTmp = Option::get('catalog', 'avail_content_groups');

		Option::delete('catalog', array());
		$z = CGroup::GetList(($v1="id"),($v2="asc"), array("ACTIVE" => "Y", "ADMIN" => "N"));
		while($zr = $z->Fetch())
Beispiel #24
0
 public static function OnBuildSocNetLogFilter(&$filter, &$params, &$componentParams)
 {
     if (isset($filter['<=LOG_DATE']) && $filter['<=LOG_DATE'] === 'NOW') {
         //HACK: Clear filter by current time - is absolutely useless in CRM context and prevent db-engine from caching of query.
         unset($filter['<=LOG_DATE']);
     }
     if (isset($filter['SITE_ID']) && \Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')) {
         //HACK: Clear filter by SITE_ID in bitrix24 context.
         unset($filter['SITE_ID']);
     }
     if (!is_array($params)) {
         $params = array();
     }
     if (!(isset($params['AFFECTED_TYPES']) && is_array($params['AFFECTED_TYPES']))) {
         $params['AFFECTED_TYPES'] = array();
     }
     $entityType = isset($params['ENTITY_TYPE']) ? $params['ENTITY_TYPE'] : '';
     $entityID = isset($params['ENTITY_ID']) ? intval($params['ENTITY_ID']) : 0;
     $options = isset($params['OPTIONS']) ? $params['OPTIONS'] : null;
     if (!is_array($options)) {
         $options = array();
     }
     $customData = isset($options['CUSTOM_DATA']) ? $options['CUSTOM_DATA'] : null;
     if (!is_array($customData)) {
         $customData = array();
     }
     $presetTopID = isset($customData['CRM_PRESET_TOP_ID']) ? $customData['CRM_PRESET_TOP_ID'] : '';
     $presetID = isset($customData['CRM_PRESET_ID']) ? $customData['CRM_PRESET_ID'] : '';
     $entityTypeID = CCrmLiveFeedEntity::ResolveEntityTypeID($entityType);
     if ($entityTypeID === CCrmOwnerType::Undefined) {
         $isActivityPresetEnabled = $presetID === 'activities';
         $isMessagePresetEnabled = $presetID === 'messages';
         $affectedEntityTypes = array();
         if ($isActivityPresetEnabled) {
             $filter['ENTITY_TYPE'] = CCrmLiveFeedEntity::Activity;
             $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Activity);
             $affectedEntityTypes[] = CCrmLiveFeedEntity::Activity;
         } else {
             if ($isMessagePresetEnabled) {
                 $filter['@EVENT_ID'] = array(CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Lead, CCrmLiveFeedEvent::Message), CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Contact, CCrmLiveFeedEvent::Message), CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Company, CCrmLiveFeedEvent::Message), CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Message), CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Invoice, CCrmLiveFeedEvent::Message));
             } else {
                 //Prepare general crm entities log
                 $filter['@ENTITY_TYPE'] = array(CCrmLiveFeedEntity::Lead, CCrmLiveFeedEntity::Contact, CCrmLiveFeedEntity::Company, CCrmLiveFeedEntity::Deal, CCrmLiveFeedEntity::Activity, CCrmLiveFeedEntity::Invoice);
             }
         }
         if ($presetTopID !== 'all' && (!isset($filter["ID"]) || intval($filter["ID"]) <= 0)) {
             $joinData = array();
             $filterValue = array('USER_ID' => CCrmSecurityHelper::GetCurrentUserID(), 'ENTITY_TYPES' => $affectedEntityTypes);
             $sqlOptions = array('TOP' => 20000);
             $startTime = isset($filter['>=LOG_UPDATE']) ? $filter['>=LOG_UPDATE'] : '';
             if ($startTime !== '') {
                 $sqlOptions['START_TIME'] = $startTime;
             }
             $subscrSqlData = self::BuildSubscriptionSelectSql($filterValue, $sqlOptions);
             $subscrRootSql = isset($subscrSqlData['ROOT_SQL']) ? $subscrSqlData['ROOT_SQL'] : '';
             $subscrLeafSql = isset($subscrSqlData['LEAF_SQL']) ? $subscrSqlData['LEAF_SQL'] : '';
             if ($subscrRootSql !== '') {
                 $joinData[] = "({$subscrRootSql})";
             }
             if ($subscrLeafSql !== '') {
                 $joinData[] = "({$subscrLeafSql})";
             }
             $userAuthorshipSql = self::BuilUserAuthorshipSelectSql($filterValue, $sqlOptions);
             if ($userAuthorshipSql !== '') {
                 $joinData[] = "({$userAuthorshipSql})";
             }
             $userAddresseeSql = self::BuilUserAddresseeSelectSql($filterValue, $sqlOptions);
             if ($userAddresseeSql !== '') {
                 $joinData[] = "({$userAddresseeSql})";
             }
             if (!empty($joinData)) {
                 if (isset($filter['__CRM_JOINS'])) {
                     $filter['__CRM_JOINS'] = array();
                 }
                 $joinSql = implode(' UNION ', $joinData);
                 $filter['__CRM_JOINS'][] = array('TYPE' => 'INNER', 'SQL' => "INNER JOIN ({$joinSql}) T ON T.ID = L.ID");
                 AddEventHandler('socialnetwork', 'OnBuildSocNetLogSql', array(__CLASS__, 'OnBuildSocNetLogSql'));
                 if (isset($filter['>=LOG_UPDATE'])) {
                     unset($filter['>=LOG_UPDATE']);
                 }
             }
             /*$filter['__INNER_FILTER_CRM'] = array(
             			'__INNER_FILTER_CRM_SUBSCRIPTION' =>
             				array(
             					'LOGIC' => 'OR',
             					'CRM_USER_SUBSCR' => array($filterValue),
             					'CRM_USER_AUTHOR' => array($filterValue),
             					'CRM_USER_ADDRESSEE' => array($filterValue)
             				)
             		);*/
         } else {
             $componentParams["SHOW_UNREAD"] = "N";
         }
         return;
     }
     if ($entityID <= 0) {
         //Invalid arguments - entityType is specified, but entityID is not.
         return;
     }
     $isExtendedMode = $presetTopID === 'extended';
     $isActivityPresetEnabled = $presetID === 'activities';
     $isMessagePresetEnabled = $presetID === 'messages';
     $isPresetDisabled = !$isActivityPresetEnabled && !$isMessagePresetEnabled;
     $mainFilter = array();
     $level1Filter = array('PARENT' => array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID($entityTypeID), 'ENTITY_ID' => $entityID), 'LOGIC' => 'OR', 'SUB_FILTERS' => array());
     $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID($entityTypeID);
     $level2Filter = null;
     //ACTIVITIES & MESSAGES -->
     if ($isPresetDisabled || $isActivityPresetEnabled) {
         $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Activity));
         $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Activity);
     }
     if (!$isActivityPresetEnabled) {
         $mainFilter['LOGIC'] = 'OR';
         $mainFilter['__INNER_FILTER_CRM_ENTITY'] = array('ENTITY_TYPE' => $entityType, 'ENTITY_ID' => $entityID);
         if ($isMessagePresetEnabled) {
             $mainFilter['__INNER_FILTER_CRM_ENTITY']['EVENT_ID'] = array(CCrmLiveFeedEvent::GetEventID($entityType, CCrmLiveFeedEvent::Message));
         }
         //MESSAGES -->
         $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Lead), 'EVENT_ID' => CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Lead, CCrmLiveFeedEvent::Message));
         $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Lead);
         $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Contact), 'EVENT_ID' => CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Contact, CCrmLiveFeedEvent::Message));
         $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Lead);
         $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Company), 'EVENT_ID' => CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Company, CCrmLiveFeedEvent::Message));
         $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Lead);
         $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Deal), 'EVENT_ID' => CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Message));
         $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Deal);
         //<-- MESSAGES
     }
     //<-- ACTIVITIES & MESSAGES
     switch ($entityTypeID) {
         case CCrmOwnerType::Contact:
             //DEALS -->
             $dealEvents = array();
             if ($isPresetDisabled) {
                 $dealEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Add);
                 $dealEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Progress);
                 $dealEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Client);
             }
             if (!empty($dealEvents)) {
                 $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Deal), 'EVENT_ID' => $dealEvents);
                 $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Deal);
             }
             //<-- DEALS
             //INVOICES -->
             if ($isPresetDisabled) {
                 $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Invoice));
                 $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Invoice);
             }
             //<-- INVOICES
             break;
         case CCrmOwnerType::Company:
             //CONTACTS -->
             $contactEvents = array();
             if ($isPresetDisabled) {
                 $contactEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Contact, CCrmLiveFeedEvent::Add);
             }
             if ($isExtendedMode && $isPresetDisabled) {
                 $contactEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Contact, CCrmLiveFeedEvent::Owner);
             }
             if (!empty($contactEvents)) {
                 $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Contact), 'EVENT_ID' => $contactEvents);
                 $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Contact);
             }
             //<-- CONTACTS
             //DEALS -->
             $dealEvents = array();
             if ($isPresetDisabled) {
                 $dealEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Add);
                 $dealEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Progress);
                 $dealEvents[] = CCrmLiveFeedEvent::GetEventID(CCrmLiveFeedEntity::Deal, CCrmLiveFeedEvent::Client);
             }
             if (!empty($dealEvents)) {
                 $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Deal), 'EVENT_ID' => $dealEvents);
                 $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Deal);
             }
             //<-- DEALS
             //INVOICES -->
             if ($isPresetDisabled) {
                 $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Invoice));
                 $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Invoice);
             }
             //<-- INVOICES
             //CONTACT ACTIVITIES -->
             if ($isExtendedMode && ($isPresetDisabled || $isActivityPresetEnabled)) {
                 $level2Filter = array('PARENT' => array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Contact), 'PARENT' => array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Company), 'ENTITY_ID' => $entityID)), 'SUB_FILTERS' => array(array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Activity))));
             }
             //<-- CONTACT ACTIVITIES
             break;
         case CCrmOwnerType::Deal:
             //INVOICES -->
             if ($isPresetDisabled) {
                 $level1Filter['SUB_FILTERS'][] = array('ENTITY_TYPE' => CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Invoice));
                 $params['AFFECTED_TYPES'][] = CCrmLiveFeedEntity::GetByEntityTypeID(CCrmOwnerType::Invoice);
             }
             //<-- INVOICES
             break;
     }
     $relationFilters = array();
     if (!empty($level1Filter['SUB_FILTERS'])) {
         $relationFilters[] = $level1Filter;
     }
     if (is_array($level2Filter)) {
         $relationFilters[] = $level2Filter;
     }
     /*if(!empty($relationFilters))
     		{
     			$mainFilter['__INNER_FILTER_CRM_RELATION'] = array('CRM_RELATION' => $relationFilters);
     		}
     		$filter['__INNER_FILTER_CRM'] = $mainFilter;*/
     $joinData = array();
     if (!empty($mainFilter)) {
         if (isset($mainFilter['__INNER_FILTER_CRM_ENTITY'])) {
             $contextFilter = $mainFilter['__INNER_FILTER_CRM_ENTITY'];
             $entityTypeName = $contextFilter['ENTITY_TYPE'];
             $entityID = $contextFilter['ENTITY_ID'];
             $eventIDs = isset($contextFilter['EVENT_ID']) ? $contextFilter['EVENT_ID'] : null;
             if ($eventIDs !== null && !empty($eventIDs)) {
                 foreach ($eventIDs as $k => $v) {
                     $eventIDs[$k] = "'{$v}'";
                 }
                 $eventIDSql = implode(',', $eventIDs);
                 $joinData[] = "(SELECT L1.ID FROM b_sonet_log L1 WHERE L1.ENTITY_TYPE = '{$entityTypeName}' AND L1.ENTITY_ID = {$entityID} AND L1.EVENT_ID IN({$eventIDSql}))";
             } else {
                 $joinData[] = "(SELECT L1.ID FROM b_sonet_log L1 WHERE L1.ENTITY_TYPE = '{$entityTypeName}' AND L1.ENTITY_ID = {$entityID})";
             }
         }
     }
     if (!empty($relationFilters)) {
         foreach ($relationFilters as &$relationFilter) {
             $relationSql = self::BuildRelationSelectSql($relationFilter);
             if (is_string($relationSql) && $relationSql !== '') {
                 $joinData[] = "({$relationSql})";
             }
         }
         unset($relationFilter);
     }
     if (!empty($joinData)) {
         if (isset($filter['__CRM_JOINS'])) {
             $filter['__CRM_JOINS'] = array();
         }
         $joinSql = implode(' UNION ', $joinData);
         $filter['__CRM_JOINS'][] = array('TYPE' => 'INNER', 'SQL' => "INNER JOIN ({$joinSql}) T ON T.ID = L.ID");
         AddEventHandler('socialnetwork', 'OnBuildSocNetLogSql', array(__CLASS__, 'OnBuildSocNetLogSql'));
     }
 }
Beispiel #25
0
if (isset($arParams['USE_COMMON_SETTINGS_BASKET_POPUP']) && $arParams['USE_COMMON_SETTINGS_BASKET_POPUP'] == 'Y') {
    $basketAction = isset($arParams['COMMON_ADD_TO_BASKET_ACTION']) ? $arParams['COMMON_ADD_TO_BASKET_ACTION'] : '';
} else {
    $basketAction = isset($arParams['SECTION_ADD_TO_BASKET_ACTION']) ? $arParams['SECTION_ADD_TO_BASKET_ACTION'] : '';
}
$intSectionID = 0;
$intSectionID = $APPLICATION->IncludeComponent("bitrix:catalog.section", "", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "ELEMENT_SORT_FIELD" => $arParams["ELEMENT_SORT_FIELD"], "ELEMENT_SORT_ORDER" => $arParams["ELEMENT_SORT_ORDER"], "ELEMENT_SORT_FIELD2" => $arParams["ELEMENT_SORT_FIELD2"], "ELEMENT_SORT_ORDER2" => $arParams["ELEMENT_SORT_ORDER2"], "PROPERTY_CODE" => $arParams["LIST_PROPERTY_CODE"], "META_KEYWORDS" => $arParams["LIST_META_KEYWORDS"], "META_DESCRIPTION" => $arParams["LIST_META_DESCRIPTION"], "BROWSER_TITLE" => $arParams["LIST_BROWSER_TITLE"], "SET_LAST_MODIFIED" => $arParams["SET_LAST_MODIFIED"], "INCLUDE_SUBSECTIONS" => $arParams["INCLUDE_SUBSECTIONS"], "BASKET_URL" => $arParams["BASKET_URL"], "ACTION_VARIABLE" => $arParams["ACTION_VARIABLE"], "PRODUCT_ID_VARIABLE" => $arParams["PRODUCT_ID_VARIABLE"], "SECTION_ID_VARIABLE" => $arParams["SECTION_ID_VARIABLE"], "PRODUCT_QUANTITY_VARIABLE" => $arParams["PRODUCT_QUANTITY_VARIABLE"], "PRODUCT_PROPS_VARIABLE" => $arParams["PRODUCT_PROPS_VARIABLE"], "FILTER_NAME" => $arParams["FILTER_NAME"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "CACHE_FILTER" => $arParams["CACHE_FILTER"], "CACHE_GROUPS" => $arParams["CACHE_GROUPS"], "SET_TITLE" => $arParams["SET_TITLE"], "MESSAGE_404" => $arParams["MESSAGE_404"], "SET_STATUS_404" => $arParams["SET_STATUS_404"], "SHOW_404" => $arParams["SHOW_404"], "FILE_404" => $arParams["FILE_404"], "DISPLAY_COMPARE" => $arParams["USE_COMPARE"], "PAGE_ELEMENT_COUNT" => $arParams["PAGE_ELEMENT_COUNT"], "LINE_ELEMENT_COUNT" => $arParams["LINE_ELEMENT_COUNT"], "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"], "USE_PRODUCT_QUANTITY" => $arParams['USE_PRODUCT_QUANTITY'], "ADD_PROPERTIES_TO_BASKET" => isset($arParams["ADD_PROPERTIES_TO_BASKET"]) ? $arParams["ADD_PROPERTIES_TO_BASKET"] : '', "PARTIAL_PRODUCT_PROPERTIES" => isset($arParams["PARTIAL_PRODUCT_PROPERTIES"]) ? $arParams["PARTIAL_PRODUCT_PROPERTIES"] : '', "PRODUCT_PROPERTIES" => $arParams["PRODUCT_PROPERTIES"], "DISPLAY_TOP_PAGER" => $arParams["DISPLAY_TOP_PAGER"], "DISPLAY_BOTTOM_PAGER" => $arParams["DISPLAY_BOTTOM_PAGER"], "PAGER_TITLE" => $arParams["PAGER_TITLE"], "PAGER_SHOW_ALWAYS" => $arParams["PAGER_SHOW_ALWAYS"], "PAGER_TEMPLATE" => $arParams["PAGER_TEMPLATE"], "PAGER_DESC_NUMBERING" => $arParams["PAGER_DESC_NUMBERING"], "PAGER_DESC_NUMBERING_CACHE_TIME" => $arParams["PAGER_DESC_NUMBERING_CACHE_TIME"], "PAGER_SHOW_ALL" => $arParams["PAGER_SHOW_ALL"], "PAGER_BASE_LINK_ENABLE" => $arParams["PAGER_BASE_LINK_ENABLE"], "PAGER_BASE_LINK" => $arParams["PAGER_BASE_LINK"], "PAGER_PARAMS_NAME" => $arParams["PAGER_PARAMS_NAME"], "OFFERS_CART_PROPERTIES" => $arParams["OFFERS_CART_PROPERTIES"], "OFFERS_FIELD_CODE" => $arParams["LIST_OFFERS_FIELD_CODE"], "OFFERS_PROPERTY_CODE" => $arParams["LIST_OFFERS_PROPERTY_CODE"], "OFFERS_SORT_FIELD" => $arParams["OFFERS_SORT_FIELD"], "OFFERS_SORT_ORDER" => $arParams["OFFERS_SORT_ORDER"], "OFFERS_SORT_FIELD2" => $arParams["OFFERS_SORT_FIELD2"], "OFFERS_SORT_ORDER2" => $arParams["OFFERS_SORT_ORDER2"], "OFFERS_LIMIT" => $arParams["LIST_OFFERS_LIMIT"], "SECTION_ID" => $arResult["VARIABLES"]["SECTION_ID"], "SECTION_CODE" => $arResult["VARIABLES"]["SECTION_CODE"], "SECTION_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["section"], "DETAIL_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["element"], "USE_MAIN_ELEMENT_SECTION" => $arParams["USE_MAIN_ELEMENT_SECTION"], 'CONVERT_CURRENCY' => $arParams['CONVERT_CURRENCY'], 'CURRENCY_ID' => $arParams['CURRENCY_ID'], 'HIDE_NOT_AVAILABLE' => $arParams["HIDE_NOT_AVAILABLE"], 'LABEL_PROP' => $arParams['LABEL_PROP'], 'ADD_PICT_PROP' => $arParams['ADD_PICT_PROP'], 'PRODUCT_DISPLAY_MODE' => $arParams['PRODUCT_DISPLAY_MODE'], 'OFFER_ADD_PICT_PROP' => $arParams['OFFER_ADD_PICT_PROP'], 'OFFER_TREE_PROPS' => $arParams['OFFER_TREE_PROPS'], 'PRODUCT_SUBSCRIPTION' => $arParams['PRODUCT_SUBSCRIPTION'], 'SHOW_DISCOUNT_PERCENT' => $arParams['SHOW_DISCOUNT_PERCENT'], 'SHOW_OLD_PRICE' => $arParams['SHOW_OLD_PRICE'], 'MESS_BTN_BUY' => $arParams['MESS_BTN_BUY'], 'MESS_BTN_ADD_TO_BASKET' => $arParams['MESS_BTN_ADD_TO_BASKET'], 'MESS_BTN_SUBSCRIBE' => $arParams['MESS_BTN_SUBSCRIBE'], 'MESS_BTN_DETAIL' => $arParams['MESS_BTN_DETAIL'], 'MESS_NOT_AVAILABLE' => $arParams['MESS_NOT_AVAILABLE'], 'TEMPLATE_THEME' => isset($arParams['TEMPLATE_THEME']) ? $arParams['TEMPLATE_THEME'] : '', "ADD_SECTIONS_CHAIN" => "N", 'ADD_TO_BASKET_ACTION' => $basketAction, 'SHOW_CLOSE_POPUP' => isset($arParams['COMMON_SHOW_CLOSE_POPUP']) ? $arParams['COMMON_SHOW_CLOSE_POPUP'] : '', 'COMPARE_PATH' => $arResult['FOLDER'] . $arResult['URL_TEMPLATES']['compare']), $component);
$GLOBALS['CATALOG_CURRENT_SECTION_ID'] = $intSectionID;
unset($basketAction);
if ($verticalGrid) {
    ?>
</div>
	<div style="clear: both;"></div>
	</div><?php 
}
if (ModuleManager::isModuleInstalled("sale")) {
    $arRecomData = array();
    $recomCacheID = array('IBLOCK_ID' => $arParams['IBLOCK_ID']);
    $obCache = new CPHPCache();
    if ($obCache->InitCache(36000, serialize($recomCacheID), "/sale/bestsellers")) {
        $arRecomData = $obCache->GetVars();
    } elseif ($obCache->StartDataCache()) {
        if (Loader::includeModule("catalog")) {
            $arSKU = CCatalogSKU::GetInfoByProductIBlock($arParams['IBLOCK_ID']);
            $arRecomData['OFFER_IBLOCK_ID'] = !empty($arSKU) ? $arSKU['IBLOCK_ID'] : 0;
        }
        $obCache->EndDataCache($arRecomData);
    }
    if (!empty($arRecomData)) {
        if (!isset($arParams['USE_SALE_BESTSELLERS']) || $arParams['USE_SALE_BESTSELLERS'] != 'N') {
            $APPLICATION->IncludeComponent("bitrix:sale.bestsellers", "", array("HIDE_NOT_AVAILABLE" => $arParams["HIDE_NOT_AVAILABLE"], "PAGE_ELEMENT_COUNT" => "5", "SHOW_DISCOUNT_PERCENT" => $arParams['SHOW_DISCOUNT_PERCENT'], "PRODUCT_SUBSCRIPTION" => $arParams['PRODUCT_SUBSCRIPTION'], "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'], "LINE_ELEMENT_COUNT" => 5, "TEMPLATE_THEME" => isset($arParams['TEMPLATE_THEME']) ? $arParams['TEMPLATE_THEME'] : '', "DETAIL_URL" => $arResult["FOLDER"] . $arResult["URL_TEMPLATES"]["element"], "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"], "CACHE_GROUPS" => $arParams["CACHE_GROUPS"], "BY" => array(0 => "AMOUNT"), "PERIOD" => array(0 => "15"), "FILTER" => array(0 => "CANCELED", 1 => "ALLOW_DELIVERY", 2 => "PAYED", 3 => "DEDUCTED", 4 => "N", 5 => "P", 6 => "F"), "FILTER_NAME" => $arParams["FILTER_NAME"], "ORDER_FILTER_NAME" => "arOrderFilter", "DISPLAY_COMPARE" => $arParams["USE_COMPARE"], "SHOW_OLD_PRICE" => $arParams['SHOW_OLD_PRICE'], "PRICE_CODE" => $arParams["PRICE_CODE"], "SHOW_PRICE_COUNT" => $arParams["SHOW_PRICE_COUNT"], "PRICE_VAT_INCLUDE" => $arParams["PRICE_VAT_INCLUDE"], "CONVERT_CURRENCY" => $arParams["CONVERT_CURRENCY"], "CURRENCY_ID" => $arParams["CURRENCY_ID"], "BASKET_URL" => $arParams["BASKET_URL"], "ACTION_VARIABLE" => (!empty($arParams["ACTION_VARIABLE"]) ? $arParams["ACTION_VARIABLE"] : "action") . "_slb", "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"] : '', "USE_PRODUCT_QUANTITY" => $arParams['USE_PRODUCT_QUANTITY'], "SHOW_PRODUCTS_" . $arParams["IBLOCK_ID"] => "Y", "OFFER_TREE_PROPS_" . $arRecomData['OFFER_IBLOCK_ID'] => $arParams["OFFER_TREE_PROPS"], "ADDITIONAL_PICT_PROP_" . $arParams['IBLOCK_ID'] => $arParams['ADD_PICT_PROP'], "ADDITIONAL_PICT_PROP_" . $arRecomData['OFFER_IBLOCK_ID'] => $arParams['OFFER_ADD_PICT_PROP']), $component, array("HIDE_ICONS" => "Y"));
Beispiel #26
0
<?
/**
 * Bitrix vars
 * @global CMain $APPLICATION
 * @global CAdminMenu $this
 */

use \Bitrix\Seo\Adv;
use \Bitrix\Seo\Engine;
use \Bitrix\Main\Localization\Loc;

if($APPLICATION->GetGroupRight("seo") > "D")
{
	if(\Bitrix\Main\ModuleManager::isModuleInstalled('seo'))
	{
		IncludeModuleLangFile(__FILE__);

		$bShowYandexServices =
			COption::GetOptionString('main', 'vendor', '') == '1c_bitrix'
			&& Loc::getDefaultLang(LANGUAGE_ID) == 'ru';

		$aMenu = array(
			array(
				"parent_menu" => "global_menu_services",
				"section" => "seo",
				"sort" => 80,
				"text" => Loc::getMessage("SEO_MENU_MAIN"),
				"title" => Loc::getMessage("SEO_MENU_MAIN_TITLE"),
				"icon" => "seo_menu_icon",
				"page_icon" => "seo_page_icon",
				"module_id" => "seo",
Beispiel #27
0
    if (ModuleManager::isModuleInstalled("blog")) {
        $arTemplateParameters['BLOG_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BLOG_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
        if (isset($arCurrentValues['BLOG_USE']) && $arCurrentValues['BLOG_USE'] == 'Y') {
            $arTemplateParameters['BLOG_URL'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BLOG_URL'), 'TYPE' => 'STRING', 'DEFAULT' => 'catalog_comments');
            $arTemplateParameters['BLOG_EMAIL_NOTIFY'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BLOG_EMAIL_NOTIFY'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N');
        }
    }
    $boolRus = false;
    $langBy = "id";
    $langOrder = "asc";
    $rsLangs = CLanguage::GetList($langBy, $langOrder, array('ID' => 'ru', "ACTIVE" => "Y"));
    if ($arLang = $rsLangs->Fetch()) {
        $boolRus = true;
    }
    if ($boolRus) {
        $arTemplateParameters['VK_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_VK_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
        if (isset($arCurrentValues['VK_USE']) && 'Y' == $arCurrentValues['VK_USE']) {
            $arTemplateParameters['VK_API_ID'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_VK_API_ID'), 'TYPE' => 'STRING', 'DEFAULT' => 'API_ID');
        }
    }
    $arTemplateParameters['FB_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_FB_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
    if (isset($arCurrentValues['FB_USE']) && 'Y' == $arCurrentValues['FB_USE']) {
        $arTemplateParameters['FB_APP_ID'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_FB_APP_ID'), 'TYPE' => 'STRING', 'DEFAULT' => '');
    }
}
if (ModuleManager::isModuleInstalled("highloadblock")) {
    $arTemplateParameters['BRAND_USE'] = array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CP_BCE_TPL_BRAND_USE'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
    if (isset($arCurrentValues['BRAND_USE']) && $arCurrentValues['BRAND_USE'] == 'Y') {
        $arTemplateParameters['BRAND_PROP_CODE'] = array('PARENT' => 'VISUAL', "NAME" => GetMessage("CP_BCE_TPL_BRAND_PROP_CODE"), "TYPE" => "LIST", "VALUES" => $arHighloadPropList, "MULTIPLE" => "Y", "ADDITIONAL_VALUES" => "Y");
    }
}
Beispiel #28
0
 /**
  * Check if module exists and installed
  *
  * @return bool
  */
 public function isRegistered()
 {
     return ModuleManager::isModuleInstalled($this->name) && $this->exist();
 }
Beispiel #29
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arTemplateParameters['LINE_ELEMENT_COUNT'] = array("PARENT" => "VISUAL", "NAME" => GetMessage("SRP_LINE_ELEMENT_COUNT"), "TYPE" => "STRING", "DEFAULT" => "3");
$arThemes = array();
if (\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix.eshop')) {
    $arThemes['site'] = GetMessage('SRP_TPL_THEME_SITE');
}
$arThemesList = array('blue' => GetMessage('SRP_TPL_THEME_BLUE'), 'green' => GetMessage('SRP_TPL_THEME_GREEN'), 'red' => GetMessage('SRP_TPL_THEME_RED'), 'wood' => GetMessage('SRP_TPL_THEME_WOOD'), 'yellow' => GetMessage('SRP_TPL_THEME_YELLOW'), 'black' => GetMessage('SRP_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("SRP_TPL_TEMPLATE_THEME"), 'TYPE' => 'LIST', 'VALUES' => $arThemes, 'DEFAULT' => 'blue', 'ADDITIONAL_VALUES' => 'Y');
Beispiel #30
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
/** @var array $arCurrentValues */
use Bitrix\Main\Loader;
if (!Loader::includeModule("iblock")) {
    return;
}
$useBlogs = \Bitrix\Main\ModuleManager::isModuleInstalled('blog');
$arIBlockTypes = CIBlockParameters::GetIBlockTypes();
$arIBlock = array();
$iblockFilter = !empty($arCurrentValues['IBLOCK_TYPE']) ? array('TYPE' => $arCurrentValues['IBLOCK_TYPE'], 'ACTIVE' => 'Y') : array('ACTIVE' => 'Y');
$rsIBlock = CIBlock::GetList(array('SORT' => 'ASC'), $iblockFilter);
while ($arr = $rsIBlock->Fetch()) {
    $arIBlock[$arr['ID']] = '[' . $arr['ID'] . '] ' . $arr['NAME'];
}
unset($arr, $rsIBlock, $iblockFilter);
$arComponentParameters = array("GROUPS" => array("BLOG" => array("NAME" => GetMessage("CATALOG_SC_BLOG_SECTION_TITLE")), "FB" => array("NAME" => GetMessage("CATALOG_SC_FB_SECTION_TITLE")), "VK" => array("NAME" => GetMessage("CATALOG_SC_VK_SECTION_TITLE"))), "PARAMETERS" => array("IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_SC_IBLOCK_TYPE"), "TYPE" => "LIST", "VALUES" => $arIBlockTypes, "REFRESH" => "Y"), "IBLOCK_ID" => array("NAME" => GetMessage("CATALOG_SC_IBLOCK_ID"), "PARENT" => "BASE", "TYPE" => "LIST", "ADDITIONAL_VALUES" => "Y", "VALUES" => $arIBlock, "REFRESH" => "Y"), "ELEMENT_ID" => array("NAME" => GetMessage("CATALOG_SC_ELEMENT_ID"), "TYPE" => "STRING", "PARENT" => "BASE", "DEFAULT" => '={$_REQUEST["ELEMENT_ID"]}'), "ELEMENT_CODE" => array("NAME" => GetMessage("CATALOG_SC_ELEMENT_CODE"), "TYPE" => "STRING", "PARENT" => "BASE", "DEFAULT" => ''), "URL_TO_COMMENT" => array("NAME" => GetMessage("CATALOG_SC_URL_TO_COMMENT"), "TYPE" => "STRING", "PARENT" => "BASE"), "WIDTH" => array("NAME" => GetMessage("CATALOG_SC_WIDTH"), "TYPE" => "STRING", "PARENT" => "BASE"), "COMMENTS_COUNT" => array("NAME" => GetMessage("CATALOG_SC_COMMENTS_COUNT"), "TYPE" => "STRING", "PARENT" => "BASE", "DEFAULT" => "5"), "SHOW_DEACTIVATED" => array("NAME" => GetMessage('CATALOG_SC_SHOW_DEACTIVATED'), "TYPE" => "CHECKBOX", "PARENT" => "BASE", "DEFAULT" => "N"), "BLOG_USE" => array("NAME" => GetMessage("CATALOG_SC_BLOG_USE"), "TYPE" => "CHECKBOX", "PARENT" => "BLOG", "DEFAULT" => "N", "REFRESH" => "Y"), "FB_USE" => array("NAME" => GetMessage("CATALOG_SC_FB_USE"), "TYPE" => "CHECKBOX", "PARENT" => "FB", "DEFAULT" => "N", "REFRESH" => "Y"), "VK_USE" => array("NAME" => GetMessage("CATALOG_SC_VK_USE"), "TYPE" => "CHECKBOX", "PARENT" => "VK", "DEFAULT" => "N", "REFRESH" => "Y"), "CACHE_TIME" => array("DEFAULT" => 0)));
if (!$useBlogs) {
    unset($arComponentParameters['GROUPS']['BLOG']);
    unset($arComponentParameters['PARAMETERS']['BLOG_USE']);
}
if ($useBlogs && isset($arCurrentValues["BLOG_USE"]) && $arCurrentValues["BLOG_USE"] == "Y") {
    $arComponentParameters["PARAMETERS"]["BLOG_TITLE"] = array("NAME" => GetMessage("CATALOG_SC_BLOG_TITLE"), "TYPE" => "STRING", "PARENT" => "BLOG", "DEFAULT" => GetMessage("CATALOG_SC_BLOG_TITLE_VALUE"));
    $arComponentParameters["PARAMETERS"]["BLOG_URL"] = array("NAME" => GetMessage("CATALOG_SC_BLOG_URL"), "TYPE" => "STRING", "PARENT" => "BLOG", "DEFAULT" => "catalog_comments");
    $arComponentParameters["PARAMETERS"]["PATH_TO_SMILE"] = array("NAME" => GetMessage("CATALOG_SC_PATH_TO_SMILE"), "TYPE" => "STRING", "PARENT" => "BLOG", "DEFAULT" => "/bitrix/images/blog/smile/");
    $arComponentParameters["PARAMETERS"]["EMAIL_NOTIFY"] = array("NAME" => GetMessage("CATALOG_SC_EMAIL_NOTIFY"), "TYPE" => "CHECKBOX", "PARENT" => "BLOG", "DEFAULT" => "N");
    $arComponentParameters["PARAMETERS"]["SHOW_SPAM"] = array("NAME" => GetMessage("CATALOG_SC_SHOW_SPAM"), "TYPE" => "CHECKBOX", "PARENT" => "BLOG", "DEFAULT" => "Y");
    $arComponentParameters["PARAMETERS"]["SHOW_RATING"] = array("NAME" => GetMessage("CATALOG_SC_SHOW_RATING"), "TYPE" => "CHECKBOX", "PARENT" => "BLOG", "DEFAULT" => "N", "REFRESH" => "Y");