1
0
mirror of synced 2024-11-22 21:36:10 +03:00

email from customer obj

This commit is contained in:
Grisha Pomadchin 2014-01-28 12:53:36 +04:00
parent fb148315d7
commit f08b54033e

View File

@ -383,23 +383,23 @@ class ICrmOrderActions
// we dont need new orders without any customers (can check only for externalId) // we dont need new orders without any customers (can check only for externalId)
if(!isset($order['customer']['externalId']) && !$order['customer']['externalId']) { if(!isset($order['customer']['externalId']) && !$order['customer']['externalId']) {
if($loginEmail) { if($loginEmail) {
if (!$order['email']) { if (!$order['customer']['email']) {
$login = 'user_' . (microtime(true) * 100); $login = 'user_' . (microtime(true) * 100);
$server_name = 0 < strlen(SITE_SERVER_NAME)? $server_name = 0 < strlen(SITE_SERVER_NAME)?
SITE_SERVER_NAME : 'server.com'; SITE_SERVER_NAME : 'server.com';
$order['email'] = $login . '@' . $server_name; $order['customer']['email'] = $login . '@' . $server_name;
$registerNewUser = true; $registerNewUser = true;
} else { } else {
// if email already used // if email already used
$dbUser = CUser::GetList(($by = 'ID'), ($sort = 'ASC'), array('=EMAIL' => $order['email'])); $dbUser = CUser::GetList(($by = 'ID'), ($sort = 'ASC'), array('=EMAIL' => $order['email']));
if ($dbUser->SelectedRowsCount() == 0) { if ($dbUser->SelectedRowsCount() == 0) {
$loginEmail ? $login = $order['email'] : $login = 'user_' . (microtime(true) * 100); $loginEmail ? $login = $order['customer']['email'] : $login = 'user_' . (microtime(true) * 100);
$registerNewUser = true; $registerNewUser = true;
} elseif ($dbUser->SelectedRowsCount() == 1) { } elseif ($dbUser->SelectedRowsCount() == 1) {
$arUser = $dbUser->Fetch(); $arUser = $dbUser->Fetch();
$registeredUserID = $arUser['ID']; $registeredUserID = $arUser['ID'];
} else { } else {
$loginEmail ? $login = $order['email'] : $login = 'user_' . (microtime(true) * 100); $loginEmail ? $login = $order['customer']['email'] : $login = 'user_' . (microtime(true) * 100);
$registerNewUser = true; $registerNewUser = true;
} }
} }
@ -410,7 +410,7 @@ class ICrmOrderActions
COption::SetOptionString('main', 'captcha_registration', 'N'); COption::SetOptionString('main', 'captcha_registration', 'N');
$userPassword = randString(10); $userPassword = randString(10);
$newUser = $USER->Register($login, $order['customer']['firstName'], $order['customer']['lastName'], $newUser = $USER->Register($login, $order['customer']['firstName'], $order['customer']['lastName'],
$userPassword, $userPassword, $order['email']); $userPassword, $userPassword, $order['customer']['email']);
if ($useCaptcha == 'Y') if ($useCaptcha == 'Y')
COption::SetOptionString('main', 'captcha_registration', 'Y'); COption::SetOptionString('main', 'captcha_registration', 'Y');
if ($newUser['TYPE'] == 'ERROR') { if ($newUser['TYPE'] == 'ERROR') {