HOR-4547: Array to convert string

This commit is contained in:
Paula Quispe
2018-05-10 12:17:34 -04:00
parent 70cf6340e1
commit 4c30fb217d
2 changed files with 16 additions and 8 deletions

View File

@@ -18,7 +18,7 @@ class Configurations // extends Configuration
* *
* @return void * @return void
*/ */
public function Configurations() public function __construct()
{ {
$this->Configuration = new Configuration(); $this->Configuration = new Configuration();
} }

View File

@@ -1740,22 +1740,30 @@ class Derivation
return $aGrp; return $aGrp;
} }
function checkReplacedByUser ($user) /**
* Review the replaced by configuration
*
* @param string $user
*
* @return string
* @throws Exception
*/
function checkReplacedByUser($user)
{ {
if (is_string( $user )) { if (is_string($user)) {
$userInstance = UsersPeer::retrieveByPK( $user ); $userInstance = UsersPeer::retrieveByPK($user);
} else { } else {
$userInstance = $user; $userInstance = $user;
} }
if (! is_object( $userInstance )) { if (is_string($user)) {
throw new Exception( "The user with the UID '$user' doesn't exist." ); throw new Exception("The user with the UID " . $user . " doesn't exist.");
} }
if ($userInstance->getUsrStatus() == 'ACTIVE') { if ($userInstance->getUsrStatus() == 'ACTIVE') {
return $userInstance->getUsrUid(); return $userInstance->getUsrUid();
} else { } else {
$userReplace = trim( $userInstance->getUsrReplacedBy() ); $userReplace = trim($userInstance->getUsrReplacedBy());
if ($userReplace != '') { if ($userReplace != '') {
return $this->checkReplacedByUser( UsersPeer::retrieveByPK( $userReplace ) ); return $this->checkReplacedByUser(UsersPeer::retrieveByPK($userReplace));
} else { } else {
return ''; return '';
} }