1
0
Fork 0
mirror of synced 2025-04-11 21:21:00 +00:00

ref #87457 generate password corporate client and checking emptines customer in order

This commit is contained in:
Ivan Chaplygin 2022-12-28 17:01:09 +03:00
parent e046a1d6f1
commit cfcfb75ecf
2 changed files with 20 additions and 3 deletions

View file

@ -335,6 +335,7 @@ class RetailCrmHistory
->setContragentTypes($contragentTypes)
->setDataCrm($order)
->build();
$corporateCustomerBuilder->getCustomerBuilder()->buildPassword();
if (RetailCrmOrder::isOrderCorporate($order)) {
// Fetch contact only if we think it's data is not fully present in order

View file

@ -495,7 +495,19 @@ class RetailCrmOrder
continue;
}
self::createCustomerForOrder($api, $arCustomer, $arCustomerCorporate,$arParams, $order, $site);
$user = UserTable::getById($order['USER_ID'])->fetch();
if (!$user) {
RCrmActions::eventLog(
'RetailCrmOrder::uploadOrders',
'UserTable::getById',
'Error find user: ' . $order['USER_ID'] . ' in order: ' . $order['ID']
);
continue;
}
self::createCustomerForOrder($api, $arCustomer, $arCustomerCorporate,$arParams, $order, $site, $user);
if (isset($order['RESPONSIBLE_ID']) && !empty($order['RESPONSIBLE_ID'])) {
$managerService = ManagerService::getInstance();
@ -579,10 +591,14 @@ class RetailCrmOrder
array &$arCustomerCorporate,
array &$arParams,
array $order,
$site
$site,
array $user = null
): void {
$optionsContragentType = RetailcrmConfigProvider::getContragentTypes();
$user = UserTable::getById($order['USER_ID'])->fetch();
if (empty($user)) {
$user = UserTable::getById($order['USER_ID'])->fetch();
}
if ('Y' === RetailcrmConfigProvider::getCorporateClientStatus()) {
if (true === RetailCrmCorporateClient::isCorpTookExternalId((string) $user['ID'], $api)) {