Merged in bugfix/PMCORE-2147 (pull request #8381)

PMCORE-2147

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Paula Quispe
2022-02-14 14:07:37 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 7 additions and 12 deletions

View File

@@ -28154,8 +28154,8 @@ msgstr "User Name"
# TRANSLATION # TRANSLATION
# LABEL/ID_USER_NAME_ALREADY_EXISTS # LABEL/ID_USER_NAME_ALREADY_EXISTS
#: LABEL/ID_USER_NAME_ALREADY_EXISTS #: LABEL/ID_USER_NAME_ALREADY_EXISTS
msgid "The User Name with {0}: \"{1}\" already exists." msgid "The User Name '{0}' already exists."
msgstr "The User Name with {0}: \"{1}\" already exists." msgstr "The User Name '{0}' already exists."
# TRANSLATION # TRANSLATION
# LABEL/ID_USER_NOT_ACTIVE # LABEL/ID_USER_NOT_ACTIVE

View File

@@ -61676,7 +61676,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_USER_LIST','en','User List','2014-01-15') , ( 'LABEL','ID_USER_LIST','en','User List','2014-01-15') ,
( 'LABEL','ID_USER_MUST_CHANGE_PASSWORD_AT_NEXT_LOGON','en','User must change password at next logon','2014-05-16') , ( 'LABEL','ID_USER_MUST_CHANGE_PASSWORD_AT_NEXT_LOGON','en','User must change password at next logon','2014-05-16') ,
( 'LABEL','ID_USER_NAME','en','User Name','2014-01-15') , ( 'LABEL','ID_USER_NAME','en','User Name','2014-01-15') ,
( 'LABEL','ID_USER_NAME_ALREADY_EXISTS','en','The User Name with {0}: "{1}" already exists.','2015-03-23') , ( 'LABEL','ID_USER_NAME_ALREADY_EXISTS','en','The User Name ''{0}'' already exists.','2022-02-11') ,
( 'LABEL','ID_USER_NOT_ACTIVE','en','The user is not active.','2015-09-08') , ( 'LABEL','ID_USER_NOT_ACTIVE','en','The user is not active.','2015-09-08') ,
( 'LABEL','ID_USER_NOT_ACTIVITY','en','The usr_uid: {0} does not have an activity assigned','2014-05-21') , ( 'LABEL','ID_USER_NOT_ACTIVITY','en','The usr_uid: {0} does not have an activity assigned','2014-05-21') ,
( 'LABEL','ID_USER_NOT_ASSIGNED_TASK','en','The user is not assigned to the task','2014-01-15') , ( 'LABEL','ID_USER_NOT_ASSIGNED_TASK','en','The user is not assigned to the task','2014-01-15') ,

View File

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