From 840271a533e2907909a5fbb3ed903bdbb0cd3389 Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Fri, 11 Feb 2022 11:40:22 -0400 Subject: [PATCH] PMCORE-2147 --- .../content/translations/english/processmaker.en.po | 4 ++-- workflow/engine/data/mysql/insert.sql | 2 +- .../engine/src/ProcessMaker/BusinessModel/User.php | 13 ++++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 870939d31..16ba5d7fc 100755 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -28154,8 +28154,8 @@ msgstr "User Name" # TRANSLATION # LABEL/ID_USER_NAME_ALREADY_EXISTS #: LABEL/ID_USER_NAME_ALREADY_EXISTS -msgid "The User Name with {0}: \"{1}\" already exists." -msgstr "The User Name with {0}: \"{1}\" already exists." +msgid "The User Name '{0}' already exists." +msgstr "The User Name '{0}' already exists." # TRANSLATION # LABEL/ID_USER_NOT_ACTIVE diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index a2663b94e..e82efeb45 100755 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -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_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_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_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') , diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index d572e0227..2c82e2e84 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -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();