Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
converterfactory.php
1
<?php
2
3
namespace
Bitrix\Sale\Exchange\OneC
;
4
5
6
use
Bitrix\Main\ArgumentOutOfRangeException
;
7
use
Bitrix\Main\NotSupportedException
;
8
use
Bitrix\Sale\Exchange\EntityType
;
9
10
class
ConverterFactory
11
{
18
public
static
function
create
($typeId)
19
{
20
if
(!is_int($typeId))
21
{
22
$typeId = (int)$typeId;
23
}
24
25
if
(!EntityType::IsDefined($typeId))
26
{
27
throw
new
ArgumentOutOfRangeException
(
'documentTypeID'
,
EntityType::FIRST
,
EntityType::LAST
);
28
}
29
30
if
($typeId ===
EntityType::ORDER
)
31
{
32
return
new
ConverterDocumentOrder
();
33
}
34
elseif($typeId ===
EntityType::SHIPMENT
)
35
{
36
return
new
ConverterDocumentShipment
();
37
}
38
elseif($typeId ===
EntityType::PAYMENT_CASH
||
39
$typeId ===
EntityType::PAYMENT_CASH_LESS
||
40
$typeId ===
EntityType::PAYMENT_CARD_TRANSACTION
||
41
$typeId ===
EntityType::INVOICE_PAYMENT_CASH
||
42
$typeId ===
EntityType::INVOICE_PAYMENT_CASH_LESS
||
43
$typeId ===
EntityType::INVOICE_PAYMENT_CARD_TRANSACTION
)
44
{
45
return
new
ConverterDocumentPayment
();
46
}
47
elseif($typeId ==
EntityType::PROFILE
||
48
$typeId ==
EntityType::USER_PROFILE
||
49
$typeId ==
EntityType::USER_PROFILE_CONTACT_COMPANY
)
50
{
51
return
new
ConverterDocumentProfile
();
52
}
53
elseif ($typeId ===
EntityType::INVOICE
)
54
{
55
return
new
ConverterDocumentInvoice
();
56
}
57
elseif ($typeId ===
EntityType::INVOICE_SHIPMENT
)
58
{
59
return
new
ConverterDocumentShipmentInvoice
();
60
}
61
else
62
{
63
throw
new
NotSupportedException
(
"Entity type: '"
.DocumentType::ResolveName($typeId).
"' is not supported in current context"
);
64
}
65
}
66
}
Bitrix\Main\ArgumentOutOfRangeException
Definition
exception.php:67
Bitrix\Main\NotSupportedException
Definition
exception.php:159
Bitrix\Sale\Exchange\EntityType
Definition
entitytype.php:6
Bitrix\Sale\Exchange\EntityType\ORDER
const ORDER
Definition
entitytype.php:8
Bitrix\Sale\Exchange\EntityType\LAST
const LAST
Definition
entitytype.php:23
Bitrix\Sale\Exchange\EntityType\INVOICE_PAYMENT_CASH
const INVOICE_PAYMENT_CASH
Definition
entitytype.php:18
Bitrix\Sale\Exchange\EntityType\USER_PROFILE_CONTACT_COMPANY
const USER_PROFILE_CONTACT_COMPANY
Definition
entitytype.php:15
Bitrix\Sale\Exchange\EntityType\INVOICE_PAYMENT_CASH_LESS
const INVOICE_PAYMENT_CASH_LESS
Definition
entitytype.php:19
Bitrix\Sale\Exchange\EntityType\PAYMENT_CASH_LESS
const PAYMENT_CASH_LESS
Definition
entitytype.php:11
Bitrix\Sale\Exchange\EntityType\INVOICE
const INVOICE
Definition
entitytype.php:16
Bitrix\Sale\Exchange\EntityType\PAYMENT_CASH
const PAYMENT_CASH
Definition
entitytype.php:10
Bitrix\Sale\Exchange\EntityType\USER_PROFILE
const USER_PROFILE
Definition
entitytype.php:14
Bitrix\Sale\Exchange\EntityType\INVOICE_PAYMENT_CARD_TRANSACTION
const INVOICE_PAYMENT_CARD_TRANSACTION
Definition
entitytype.php:20
Bitrix\Sale\Exchange\EntityType\PROFILE
const PROFILE
Definition
entitytype.php:13
Bitrix\Sale\Exchange\EntityType\FIRST
const FIRST
Definition
entitytype.php:22
Bitrix\Sale\Exchange\EntityType\SHIPMENT
const SHIPMENT
Definition
entitytype.php:9
Bitrix\Sale\Exchange\EntityType\PAYMENT_CARD_TRANSACTION
const PAYMENT_CARD_TRANSACTION
Definition
entitytype.php:12
Bitrix\Sale\Exchange\EntityType\INVOICE_SHIPMENT
const INVOICE_SHIPMENT
Definition
entitytype.php:17
Bitrix\Sale\Exchange\OneC\ConverterDocumentInvoice
Definition
converterdocumentinvoice.php:7
Bitrix\Sale\Exchange\OneC\ConverterDocumentOrder
Definition
converterdocumentorder.php:21
Bitrix\Sale\Exchange\OneC\ConverterDocumentPayment
Definition
converterdocumentpayment.php:17
Bitrix\Sale\Exchange\OneC\ConverterDocumentProfile
Definition
converterdocumentprofile.php:13
Bitrix\Sale\Exchange\OneC\ConverterDocumentShipment
Definition
converterdocumentshipment.php:21
Bitrix\Sale\Exchange\OneC\ConverterDocumentShipmentInvoice
Definition
converterdocumentshipmentinvoice.php:8
Bitrix\Sale\Exchange\OneC\ConverterFactory
Definition
converterfactory.php:11
Bitrix\Sale\Exchange\OneC\ConverterFactory\create
static create($typeId)
Definition
converterfactory.php:18
Bitrix\Sale\Exchange\OneC
Definition
documents.php:2
modules
sale
lib
exchange
onec
converterfactory.php
Создано системой
1.10.0