8458360a30
* added service for manager sync * added manager event handler in history uploading methods * deleted logger dependence from repository * extract config provider proxy methods from repository to service
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Class RetailUser
|
|
*/
|
|
class RetailUser extends CUser
|
|
{
|
|
/**
|
|
* @return int|mixed|string|null
|
|
*/
|
|
public function GetID()
|
|
{
|
|
$rsUser = CUser::GetList(($by = 'ID'), ($order = 'DESC'), ['LOGIN' => 'retailcrm']);
|
|
|
|
if ($arUser = $rsUser->Fetch()) {
|
|
return $arUser['ID'];
|
|
} else {
|
|
$retailUser = new CUser;
|
|
|
|
$userPassword = uniqid();
|
|
|
|
$arFields = [
|
|
"NAME" => 'retailcrm',
|
|
"LAST_NAME" => 'retailcrm',
|
|
"EMAIL" => 'retailcrm@retailcrm.com',
|
|
"LOGIN" => 'retailcrm',
|
|
"LID" => "ru",
|
|
"ACTIVE" => "Y",
|
|
"GROUP_ID" => [2],
|
|
"PASSWORD" => $userPassword,
|
|
"CONFIRM_PASSWORD" => $userPassword,
|
|
];
|
|
|
|
$id = $retailUser->Add($arFields);
|
|
|
|
if (!$id) {
|
|
return null;
|
|
} else {
|
|
return $id;
|
|
}
|
|
}
|
|
}
|
|
}
|