1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
configuration.php
См. документацию.
1<?php
2namespace Bitrix\Sale;
3
4use Bitrix\Main\Localization\Loc;
5use Bitrix\Main\Loader;
6use Bitrix\Main\Config;
7use Bitrix\Catalog;;
8use Bitrix\Sale\Reservation\Configuration\ReservationSettings;
9use Bitrix\Sale\Reservation\Configuration\ReservationSettingsService;
10use Bitrix\Sale\Reservation\Configuration\ReserveCondition;
11
12Loc::loadMessages(__FILE__);
13
19{
20 private static bool $enableAutomaticReservation;
21
24 const STATUS_ON_PAY = 'R';
25 const STATUS_ON_FULL_PAY = 'P';
26
33 public static function getReservationConditionList($extendedMode = false)
34 {
35 $extendedMode = ($extendedMode === true);
36 if ($extendedMode)
37 {
38 return array(
39 ReserveCondition::ON_CREATE => Loc::getMessage('SALE_CONFIGURATION_RESERVE_ON_CREATE'),
40 ReserveCondition::ON_FULL_PAY => Loc::getMessage('SALE_CONFIGURATION_RESERVE_ON_FULL_PAY'),
41 ReserveCondition::ON_PAY => Loc::getMessage('SALE_CONFIGURATION_RESERVE_ON_PAY'),
42 ReserveCondition::ON_ALLOW_DELIVERY => Loc::getMessage('SALE_CONFIGURATION_RESERVE_ON_ALLOW_DELIVERY'),
43 ReserveCondition::ON_SHIP => Loc::getMessage('SALE_CONFIGURATION_RESERVE_ON_SHIP')
44 );
45 }
46 return array(
47 ReserveCondition::ON_CREATE,
48 ReserveCondition::ON_FULL_PAY,
49 ReserveCondition::ON_PAY,
50 ReserveCondition::ON_ALLOW_DELIVERY,
51 ReserveCondition::ON_SHIP
52 );
53 }
54
60 private static function getReservationSettings(): ReservationSettings
61 {
62 static $settings;
63
64 if (!isset($settings))
65 {
67 }
68
69 return $settings;
70 }
71
78 public static function getProductReservationCondition()
79 {
80 return self::getReservationSettings()->getReserveCondition();
81 }
82
86 public static function isEnableAutomaticReservation() : bool
87 {
88 if (!isset(self::$enableAutomaticReservation))
89 {
90 self::$enableAutomaticReservation = self::getReservationSettings()->isEnableAutomaticReservation();
91 }
92 return self::$enableAutomaticReservation;
93 }
94
95 public static function enableAutomaticReservation()
96 {
97 self::$enableAutomaticReservation = true;
98 }
99
100 public static function disableAutomaticReservation()
101 {
102 self::$enableAutomaticReservation = false;
103 }
104
111 public static function getProductReserveClearPeriod()
112 {
113 return self::getReservationSettings()->getClearPeriod();
114 }
115
121 public static function isReservationDependsOnShipment()
122 {
123 $condition = static::getProductReservationCondition();
124 return in_array($condition, array(ReserveCondition::ON_SHIP, ReserveCondition::ON_ALLOW_DELIVERY));
125 }
126
132 public static function isCanUse1c(): bool
133 {
134 $lang = LANGUAGE_ID;
135 if (Loader::includeModule('bitrix24'))
136 {
137 $lang = \CBitrix24::getLicensePrefix();
138 }
139 elseif (Loader::includeModule('intranet'))
140 {
141 $lang = \CIntranetUtils::getPortalZone();
142 }
143
144 return in_array($lang, ['ru', 'ua', 'by', 'kz'], true);
145 }
146
152 public static function isAvailableOrdersImportFromB24(): bool
153 {
154 $lang = LANGUAGE_ID;
155 if (Loader::includeModule('bitrix24'))
156 {
157 $lang = \CBitrix24::getLicensePrefix();
158 }
159 elseif (Loader::includeModule('intranet'))
160 {
161 $lang = \CIntranetUtils::getPortalZone();
162 }
163
164 return in_array($lang, ['ru', 'ua', 'by', 'kz'], true);
165 }
166
172 public static function isCanUsePersonalization(): bool
173 {
174 $lang = LANGUAGE_ID;
175 if (Loader::includeModule('bitrix24'))
176 {
177 $lang = \CBitrix24::getLicensePrefix();
178 }
179 elseif (Loader::includeModule('intranet'))
180 {
181 $lang = \CIntranetUtils::getPortalZone();
182 }
183
184 return in_array($lang, ['ru', 'ua', 'by', 'kz'], true);
185 }
186
193 public static function needShipOnAllowDelivery()
194 {
195 return Config\Option::get('sale', 'allow_deduction_on_delivery') === 'Y';
196 }
197
204 public static function needAllowDeliveryOnPay()
205 {
206 $condition = static::getAllowDeliveryOnPayCondition();
207 return in_array($condition, array(static::ALLOW_DELIVERY_ON_PAY, ReserveCondition::ON_ALLOW_DELIVERY));
208 }
209
214 public static function getAllowDeliveryOnPayCondition()
215 {
216 return Config\Option::get('sale', 'status_on_change_allow_delivery_after_paid');
217 }
218
224 public static function getAllowDeliveryAfterPaidConditionList($extendedMode = false)
225 {
226 if ($extendedMode)
227 {
228 return array(
229 self::ALLOW_DELIVERY_ON_PAY => Loc::getMessage('SALE_CONFIGURATION_ON_PAY'),
230 self::ALLOW_DELIVERY_ON_FULL_PAY => Loc::getMessage('SALE_CONFIGURATION_ON_FULL_PAY'),
231 );
232 }
233 return array(
234 self::ALLOW_DELIVERY_ON_PAY,
235 self::ALLOW_DELIVERY_ON_FULL_PAY,
236 );
237 }
238
242 public static function getStatusPaidCondition()
243 {
244 return Config\Option::get('sale', 'status_on_paid_condition');
245 }
246
250 public static function getStatusAllowDeliveryCondition()
251 {
252 return Config\Option::get('sale', 'status_on_paid_condition');
253 }
254
260 public static function useStoreControl()
261 {
262 if (!Loader::includeModule('catalog'))
263 return false;
264
266 }
267
272 public static function getDefaultStoreId()
273 {
274 if (
275 !Loader::includeModule('catalog')
276 || !self::useStoreControl()
277 )
278 {
279 return 0;
280 }
281
283 }
284
291 public static function isEnabledReservation()
292 {
293 return Config\Option::get('catalog', 'enable_reservation') === 'Y';
294 }
295
301 {
302 return Config\Option::get('sale', 'discount_separately_calculation') === 'Y';
303 }
304}
static isUsedInventoryManagement()
Определения state.php:42
static getDefaultStoreId()
Определения store.php:402
static get($moduleId, $name, $default="", $siteId=false)
Определения option.php:30
static isAvailableOrdersImportFromB24()
Определения configuration.php:152
static disableAutomaticReservation()
Определения configuration.php:100
const ALLOW_DELIVERY_ON_FULL_PAY
Определения configuration.php:23
static getDefaultStoreId()
Определения configuration.php:272
const ALLOW_DELIVERY_ON_PAY
Определения configuration.php:22
static getProductReserveClearPeriod()
Определения configuration.php:111
static isEnableAutomaticReservation()
Определения configuration.php:86
static useStoreControl()
Определения configuration.php:260
static isCanUsePersonalization()
Определения configuration.php:172
static getAllowDeliveryOnPayCondition()
Определения configuration.php:214
static isAllowedSeparatelyDiscountCalculation()
Определения configuration.php:300
static getStatusPaidCondition()
Определения configuration.php:242
const STATUS_ON_PAY
Определения configuration.php:24
const STATUS_ON_FULL_PAY
Определения configuration.php:25
static enableAutomaticReservation()
Определения configuration.php:95
static getReservationConditionList($extendedMode=false)
Определения configuration.php:33
static getAllowDeliveryAfterPaidConditionList($extendedMode=false)
Определения configuration.php:224
static isEnabledReservation()
Определения configuration.php:291
static getStatusAllowDeliveryCondition()
Определения configuration.php:250
static needShipOnAllowDelivery()
Определения configuration.php:193
static needAllowDeliveryOnPay()
Определения configuration.php:204
static getProductReservationCondition()
Определения configuration.php:78
static isReservationDependsOnShipment()
Определения configuration.php:121
static isCanUse1c()
Определения configuration.php:132
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if(!defined('SITE_ID')) $lang
Определения include.php:91
$settings
Определения product_settings.php:43
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393