Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
orderidnumbergenerator.php
1
<?php
2
namespace
Bitrix\Sale\Integration\Numerator
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\Numerator\Generator\Contract\DynamicConfigurable
;
6
use
Bitrix\Main\Numerator\Generator\NumberGenerator
;
7
use
Bitrix\Sale\Registry
;
8
13
class
OrderIdNumberGenerator
extends
NumberGenerator
implements
DynamicConfigurable
14
{
15
protected
$orderId
;
16
17
const
TEMPLATE_WORD_ORDER_ID
=
"ORDER_ID"
;
18
20
public
static
function
getTemplateWordsForParse
()
21
{
22
return
[
23
static::getPatternFor(static::TEMPLATE_WORD_ORDER_ID),
24
];
25
}
26
28
public
static
function
getTemplateWordsSettings
()
29
{
30
return
[
31
static::getPatternFor(static::TEMPLATE_WORD_ORDER_ID)
32
=>
Loc::getMessage
(
'BITRIX_SALE_INTEGRATION_NUMERATOR_ORDERIDNUMBERGENERATOR_WORD_ORDER_ID'
),
33
];
34
}
35
39
public
static
function
getAvailableForType
()
40
{
41
return
Registry::REGISTRY_TYPE_ORDER
;
42
}
43
45
public
function
parseTemplate
($template)
46
{
47
if
(!is_null($this->orderId))
48
{
49
return
str_replace(self::getPatternFor(static::TEMPLATE_WORD_ORDER_ID), $this->orderId, $template);
50
}
51
return
$template;
52
}
53
57
public
function
setDynamicConfig
($config)
58
{
59
if
(is_array($config) && array_key_exists(
'ORDER_ID'
, $config))
60
{
61
$this->orderId = $config[
'ORDER_ID'
];
62
}
63
}
64
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\Numerator\Generator\NumberGenerator
Definition
numbergenerator.php:12
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator
Definition
orderidnumbergenerator.php:14
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\TEMPLATE_WORD_ORDER_ID
const TEMPLATE_WORD_ORDER_ID
Definition
orderidnumbergenerator.php:17
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\$orderId
$orderId
Definition
orderidnumbergenerator.php:15
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\getAvailableForType
static getAvailableForType()
Definition
orderidnumbergenerator.php:39
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\getTemplateWordsForParse
static getTemplateWordsForParse()
Definition
orderidnumbergenerator.php:20
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\setDynamicConfig
setDynamicConfig($config)
Definition
orderidnumbergenerator.php:57
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\parseTemplate
parseTemplate($template)
Definition
orderidnumbergenerator.php:45
Bitrix\Sale\Integration\Numerator\OrderIdNumberGenerator\getTemplateWordsSettings
static getTemplateWordsSettings()
Definition
orderidnumbergenerator.php:28
Bitrix\Sale\Registry
Definition
registry.php:13
Bitrix\Sale\Registry\REGISTRY_TYPE_ORDER
const REGISTRY_TYPE_ORDER
Definition
registry.php:16
Bitrix\Main\Numerator\Generator\Contract\DynamicConfigurable
Definition
dynamicconfigurable.php:11
Bitrix\Sale\Integration\Numerator
Definition
accountnumbercompatibilitymanager.php:2
modules
sale
lib
integration
numerator
orderidnumbergenerator.php
Создано системой
1.10.0