PMCORE-2147

This commit is contained in:
Paula Quispe
2022-02-11 11:40:22 -04:00
parent 985db58407
commit 840271a533
3 changed files with 7 additions and 12 deletions

View File

@@ -396,17 +396,15 @@ class User
* Verify if exists the Name of a User
*
* @param string $userName Name
* @param string $fieldNameForException Field name for the exception
* @param string $userUidToExclude Unique id of User to exclude
*
* @throws Exception if exists the title of a User
*/
public function throwExceptionIfExistsName($userName, $fieldNameForException, $userUidToExclude = "")
public function throwExceptionIfExistsName($userName, $userUidToExclude = "")
{
try {
if ($this->existsName($userName, $userUidToExclude)) {
throw new Exception(G::LoadTranslation("ID_USER_NAME_ALREADY_EXISTS",
array($fieldNameForException, $userName)));
throw new Exception(G::LoadTranslation("ID_USER_NAME_ALREADY_EXISTS", [$userName]));
}
} catch (Exception $e) {
throw $e;
@@ -446,7 +444,7 @@ class User
{
try {
//Set variables
$arrayUserData = ($userUid == "") ? array() : $this->getUser($userUid, true);
$arrayUserData = ($userUid == "") ? [] : $this->getUser($userUid, true);
$flagInsert = ($userUid == "") ? true : false;
$arrayFinalData = array_merge($arrayUserData, $arrayData);
@@ -459,8 +457,7 @@ class User
//Verify data
if (isset($arrayData["USR_USERNAME"])) {
$this->throwExceptionIfExistsName($arrayData["USR_USERNAME"],
$this->arrayFieldNameForException["usrUsername"], $userUid);
$this->throwExceptionIfExistsName($arrayData["USR_USERNAME"], $userUid);
}
if (isset($arrayData["USR_EMAIL"])) {
@@ -762,8 +759,6 @@ class User
public function create(array $arrayData)
{
try {
//Verify data
$validator = new Validator();