Корректировка логики создания/редактирования клиента в Bitrix
This commit is contained in:
parent
f14a087b16
commit
61177b712d
@ -1,3 +1,6 @@
|
||||
## 2022-09-07 v.6.1.6
|
||||
- Корректировка редактирования данных пользователя Bitrix при выгрузке истории изменений
|
||||
|
||||
## 2022-08-22 v.6.1.5
|
||||
- Корректировка получения НДС товаров в каталоге
|
||||
|
||||
|
@ -189,12 +189,6 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
$this->customer->setPersonalGender($this->fromJSON($this->dataCrm['sex']));
|
||||
}
|
||||
|
||||
if (empty($this->dataCrm['externalId'])) {
|
||||
$userPassword = uniqid("R");
|
||||
$this->customer->setPassword($userPassword)
|
||||
->setConfirmPassword($userPassword);
|
||||
}
|
||||
|
||||
if ((!isset($this->dataCrm['email']) || $this->dataCrm['email'] == '')
|
||||
&& (!isset($this->dataCrm['externalId']))
|
||||
) {
|
||||
@ -208,6 +202,15 @@ class CustomerBuilder extends AbstractBuilder implements RetailcrmBuilderInterfa
|
||||
}
|
||||
}
|
||||
|
||||
public function buildPassword()
|
||||
{
|
||||
$userPassword = uniqid("R");
|
||||
$this->customer->setPassword($userPassword)
|
||||
->setConfirmPassword($userPassword);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function buildAddress()
|
||||
{
|
||||
if (isset($this->dataCrm['address'])) {
|
||||
|
@ -131,6 +131,7 @@ class RetailCrmHistory
|
||||
case 0:
|
||||
$login = $customer['email'];
|
||||
$customerBuilder->setLogin($login);
|
||||
$customerBuilder->buildPassword();
|
||||
break;
|
||||
case 1:
|
||||
$arUser = $dbUser->Fetch();
|
||||
@ -140,6 +141,7 @@ class RetailCrmHistory
|
||||
default:
|
||||
$login = uniqid('user_' . time()) . '@example.com';
|
||||
$customerBuilder->setLogin($login);
|
||||
$customerBuilder->buildPassword();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -158,15 +160,15 @@ class RetailCrmHistory
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(RCrmActions::apiMethod(
|
||||
$api,
|
||||
'customersFixExternalIds',
|
||||
__METHOD__,
|
||||
array(array('id' => $customer['id'], 'externalId' => $registeredUserID))) == false
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if(RCrmActions::apiMethod(
|
||||
$api,
|
||||
'customersFixExternalIds',
|
||||
__METHOD__,
|
||||
array(array('id' => $customer['id'], 'externalId' => $registeredUserID))) == false
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$customer['externalId'] = $registeredUserID;
|
||||
@ -856,13 +858,6 @@ class RetailCrmHistory
|
||||
|
||||
if (isset($order['contact']['id'])) {
|
||||
$ExtId = null;
|
||||
$response = RCrmActions::apiMethod(
|
||||
$api,
|
||||
'customersGetById',
|
||||
__METHOD__,
|
||||
$order['contact']['id'],
|
||||
$order['site']
|
||||
);
|
||||
|
||||
if (isset($order['contact']['externalId'])) {
|
||||
$ExtId = $order['contact']['externalId'];
|
||||
@ -871,6 +866,14 @@ class RetailCrmHistory
|
||||
if (isset($ExtId)) {
|
||||
$newOrder->setFieldNoDemand('USER_ID', $ExtId);
|
||||
} else {
|
||||
$response = RCrmActions::apiMethod(
|
||||
$api,
|
||||
'customersGetById',
|
||||
__METHOD__,
|
||||
$order['contact']['id'],
|
||||
$order['site']
|
||||
);
|
||||
|
||||
$newUser = new CUser();
|
||||
$customerBuilder = new CustomerBuilder();
|
||||
$customerBuilder->setDataCrm($response['customer'])->build();
|
||||
@ -887,6 +890,7 @@ class RetailCrmHistory
|
||||
case 0:
|
||||
$login = $response['customer']['email'];
|
||||
$customerBuilder->setLogin($login);
|
||||
$customerBuilder->buildPassword();
|
||||
break;
|
||||
case 1:
|
||||
$arUser = $dbUser->Fetch();
|
||||
@ -896,6 +900,7 @@ class RetailCrmHistory
|
||||
default:
|
||||
$login = uniqid('user_' . time()) . '@example.com';
|
||||
$customerBuilder->setLogin($login);
|
||||
$customerBuilder->buildPassword();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -926,7 +931,6 @@ class RetailCrmHistory
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$newOrder->setFieldNoDemand('USER_ID', $registeredUserID);
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
- Корректировка получения НДС товаров в каталоге
|
||||
- Корректировка редактирования данных пользователя Bitrix при выгрузке истории изменений
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$arModuleVersion = [
|
||||
'VERSION' => '6.1.5',
|
||||
'VERSION_DATE' => '2022-08-22 11:00:00'
|
||||
'VERSION' => '6.1.6',
|
||||
'VERSION_DATE' => '2022-09-07 10:00:00'
|
||||
];
|
||||
|
Loading…
x
Reference in New Issue
Block a user