1
0
mirror of synced 2024-11-22 13:26:10 +03:00
bitrix-module/intaro.retailcrm/classes/general/history/RetailUser.php

55 lines
1.2 KiB
PHP

<?php
/**
* @category RetailCRM
* @package RetailCRM\History
* @author RetailCRM <integration@retailcrm.ru>
* @license MIT
* @link http://retailcrm.ru
* @see http://retailcrm.ru/docs
*/
/**
* Class RetailUser
*
* @category RetailCRM
* @package RetailCRM\History
*/
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'];
}
$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;
}
return $id;
}
}