1
0
mirror of synced 2024-11-22 13:26:10 +03:00

Update users to log changes of the order

This commit is contained in:
Dmitry Mamontov 2015-02-13 17:52:33 +03:00
parent 3a90a7c28e
commit 54e953eec4

View File

@ -478,7 +478,7 @@ class ICrmOrderActions
$registerNewUser = true; $registerNewUser = true;
if (!isset($order['customer']['email'])) { if (!isset($order['customer']['email'])) {
$login = $order['customer']['email'] = uniqid('user_' . time()) . '@retaicrm.com'; $login = $order['customer']['email'] = uniqid('user_' . time()) . '@crm.com';
} else { } else {
$dbUser = CUser::GetList(($by = 'ID'), ($sort = 'ASC'), array('=EMAIL' => $order['email'])); $dbUser = CUser::GetList(($by = 'ID'), ($sort = 'ASC'), array('=EMAIL' => $order['email']));
switch ($dbUser->SelectedRowsCount()) { switch ($dbUser->SelectedRowsCount()) {
@ -491,7 +491,7 @@ class ICrmOrderActions
$registerNewUser = false; $registerNewUser = false;
break; break;
default: default:
$login = uniqid('user_' . time()) . '@retaicrm.com'; $login = uniqid('user_' . time()) . '@crm.com';
} }
} }
@ -1015,7 +1015,7 @@ class ICrmOrderActions
if (count($orderHistory)) { if (count($orderHistory)) {
COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_HISTORY_DATE, $dateFinish->format('Y-m-d H:i:s')); COption::SetOptionString(self::$MODULE_ID, self::$CRM_ORDER_HISTORY_DATE, $dateFinish->format('Y-m-d H:i:s'));
} }
$USER = new CUser;
$GLOBALS['INTARO_CRM_FROM_HISTORY'] = false; $GLOBALS['INTARO_CRM_FROM_HISTORY'] = false;
return true; return true;
@ -1073,7 +1073,7 @@ class ICrmOrderActions
*/ */
public static function notForkedOrderAgent() { public static function notForkedOrderAgent() {
self::uploadOrdersAgent(); //self::uploadOrdersAgent();
self::orderHistory(); self::orderHistory();
return 'ICrmOrderActions::notForkedOrderAgent();'; return 'ICrmOrderActions::notForkedOrderAgent();';
} }
@ -1530,11 +1530,30 @@ class RetailUser extends CUser
{ {
public function GetID() public function GetID()
{ {
$rsUser = CUser::GetList(($by='ID'), ($order='DESC'), array('LOGIN' => '%retailcrm%')); $rsUser = CUser::GetList(($by='ID'), ($order='DESC'), array('LOGIN' => '%retailcrm%'));
if ($arUser = $rsUser->Fetch()) { if ($arUser = $rsUser->Fetch()) {
return $arUser['ID']; return $arUser['ID'];
} else { } else {
return null; $retailUser = new CUser;
$userPassword = uniqid();
$arFields = array(
"NAME" => 'retailcrm',
"LAST_NAME" => 'retailcrm',
"EMAIL" => 'retailcrm@retailcrm.com',
"LOGIN" => 'retailcrm',
"LID" => "ru",
"ACTIVE" => "Y",
"GROUP_ID" => array(2),
"PASSWORD" => $userPassword,
"CONFIRM_PASSWORD" => $userPassword
);
$id = $retailUser->Add($arFields);
if (!$id) {
return null;
} else {
return $id;
}
} }
} }
} }