1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
userprofileimport.php
См. документацию.
1
<?php
2
namespace
Bitrix\Sale\Exchange\Entity;
3
4
5
use Bitrix\Main\Error;
6
use Bitrix\Main\UserTable;
7
use Bitrix\Sale;
8
use Bitrix\Sale\Exchange\EntityType;
9
10
class
UserProfileImport
extends
UserImportBase
11
{
12
public
function
__construct
()
13
{
14
$this->fields =
new
Sale\Internals\Fields
();
15
}
16
20
public
function
getOwnerTypeId
()
21
{
22
return
EntityType::USER_PROFILE
;
23
}
24
30
public
function
add
(
array
$params
)
31
{
32
$result
=
new
Sale\Result
();
33
34
$profileId =
null
;
35
$fields
=
$params
[
'TRAITS'
];
36
$property =
$params
[
"ORDER_PROP"
];
37
38
$errorList = [];
39
$fields
[
'ID'
] = $this->
registerUser
(
$fields
, $errorList);
40
41
if
(!empty($errorList))
42
{
43
foreach
($errorList as
$error
)
44
{
45
$result
->addError(
new
Error
(str_replace(
'<br>'
,
''
,
$error
[
'TEXT'
])));
46
}
47
}
48
elseif
(intval(
$fields
[
'ID'
])>0)
49
{
50
$propertyOrders = static::getPropertyOrdersByPersonalTypeId(
$fields
[
"PERSON_TYPE_ID"
]);
51
52
if
(is_array($propertyOrders))
53
{
54
foreach
($propertyOrders as $filedsProperty)
55
{
56
$propertyId = $filedsProperty[
"ID"
];
57
if
(array_key_exists($propertyId, $property))
58
{
59
$propertyByConfigValue = $property[$propertyId];
60
if
($profileId ==
null
)
61
{
62
if
(!empty($propertyByConfigValue))
63
{
64
$profileId =
\CSaleOrderUserProps::Add
(
array
(
65
"NAME"
=>
$fields
[
"AGENT_NAME"
],
66
"USER_ID"
=>
$fields
[
'ID'
],
67
"PERSON_TYPE_ID"
=>
$fields
[
'PERSON_TYPE_ID'
],
68
"XML_ID"
=>
$fields
[
"XML_ID"
],
69
"VERSION_1C"
=>
$fields
[
"VERSION_1C"
]
70
));
71
}
72
}
73
74
\CSaleOrderUserPropsValue::Add
(
array
(
75
"USER_PROPS_ID"
=> $profileId,
76
"ORDER_PROPS_ID"
=> $propertyId,
77
"NAME"
=> $filedsProperty[
"NAME"
],
78
"VALUE"
=> $propertyByConfigValue
79
));
80
}
81
}
82
}
83
}
84
85
if
(
$result
->isSuccess())
86
{
87
$user
=
new
static
();
88
$user
->setFields(
$fields
);
89
$this->
setEntity
(
$user
);
90
}
91
92
return
$result
;
93
}
94
100
public
function
update
(
array
$params
)
101
{
102
$entity
= $this->
getEntity
();
103
104
if
(
$entity
->getId()>0)
105
static::updateEmptyXmlId(
$entity
->getId(),
$params
[
'TRAITS'
][
'XML_ID'
]);
106
107
return
new
Sale\Result
();
108
}
109
115
public
function
delete
(
array
$params
=
null
)
116
{
117
return
new
Sale\Result
();
118
}
119
124
protected
function
checkFields
(
array
$fields
)
125
{
126
return
new
Sale\Result
();
127
}
128
133
public
function
load
(
array
$fields
)
134
{
135
$result
= $this->
checkFields
($fields);
136
137
if
(
$result
->isSuccess())
138
{
139
if
(!empty(
$fields
[
'ID'
]))
140
{
141
$user
= UserTable::getById(
$fields
[
'ID'
]);
142
if
(
$fields
=
$user
->fetch())
143
{
144
$userProfile =
new
static
();
145
$userProfile->setFields(
$fields
);
146
147
$this->
setEntity
($userProfile);
148
}
149
}
150
}
151
152
return
$result
;
153
}
154
158
public
function
getId
()
159
{
160
$entity
= $this->
getEntity
();
161
if
(!empty(
$entity
))
162
{
163
return
$entity
->getField(
'ID'
);
164
}
165
return
null
;
166
}
167
171
public
function
isImportable
()
172
{
173
return
$this->settings->isImportableFor($this->
getOwnerTypeId
());
174
}
175
179
public
function
refreshData
(
array
$fields
)
180
{
181
}
182
186
public
static
function
getFieldExternalId
()
187
{
188
return
'XML_ID'
;
189
}
190
}
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Sale\Exchange\Entity\UserImportBase
Определения
userimportbase.php:12
Bitrix\Sale\Exchange\Entity\UserImportBase\getEntity
getEntity()
Определения
userimportbase.php:29
Bitrix\Sale\Exchange\Entity\UserImportBase\$entity
$entity
Определения
userimportbase.php:16
Bitrix\Sale\Exchange\Entity\UserImportBase\registerUser
registerUser($fields, &$arErrors)
Определения
userimportbase.php:207
Bitrix\Sale\Exchange\Entity\UserImportBase\setEntity
setEntity(ImportBase $entity)
Определения
userimportbase.php:21
Bitrix\Sale\Exchange\Entity\UserProfileImport
Определения
userprofileimport.php:11
Bitrix\Sale\Exchange\Entity\UserProfileImport\__construct
__construct()
Определения
userprofileimport.php:12
Bitrix\Sale\Exchange\Entity\UserProfileImport\refreshData
refreshData(array $fields)
Определения
userprofileimport.php:179
Bitrix\Sale\Exchange\Entity\UserProfileImport\getId
getId()
Определения
userprofileimport.php:158
Bitrix\Sale\Exchange\Entity\UserProfileImport\load
load(array $fields)
Определения
userprofileimport.php:133
Bitrix\Sale\Exchange\Entity\UserProfileImport\add
add(array $params)
Определения
userprofileimport.php:30
Bitrix\Sale\Exchange\Entity\UserProfileImport\isImportable
isImportable()
Определения
userprofileimport.php:171
Bitrix\Sale\Exchange\Entity\UserProfileImport\getOwnerTypeId
getOwnerTypeId()
Определения
userprofileimport.php:20
Bitrix\Sale\Exchange\Entity\UserProfileImport\getFieldExternalId
static getFieldExternalId()
Определения
userprofileimport.php:186
Bitrix\Sale\Exchange\Entity\UserProfileImport\checkFields
checkFields(array $fields)
Определения
userprofileimport.php:124
Bitrix\Sale\Exchange\Entity\UserProfileImport\update
update(array $params)
Определения
userprofileimport.php:100
Bitrix\Sale\Exchange\EntityType\USER_PROFILE
const USER_PROFILE
Определения
entitytype.php:14
Bitrix\Sale\Exchange\ImportBase\$fields
$fields
Определения
importbase.php:18
CSaleOrderUserProps\Add
static Add($arFields)
Определения
order_user_props.php:132
CSaleOrderUserPropsValue\Add
static Add($arFields)
Определения
order_user_props_value.php:178
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
Bitrix\Main\ORM\Fields
Определения
arrayfield.php:9
Bitrix\Main\$user
$user
Определения
mysql_to_pgsql.php:33
Bitrix\Sale\Discount\Result
Определения
compatibleformat.php:2
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$error
$error
Определения
subscription_card_product.php:20
bitrix
modules
sale
lib
exchange
entity
userprofileimport.php
Создано системой
1.14.0