This commit is contained in:
Paula Quispe
2017-04-21 15:03:02 -04:00
parent 37c44e0ac5
commit 174f4d632e
2 changed files with 8 additions and 4 deletions

View File

@@ -1140,6 +1140,7 @@ class User
* @param bool $flagRecord Flag that set the "getting" of record * @param bool $flagRecord Flag that set the "getting" of record
* @param bool $throwException Flag to throw the exception (This only if the parameters are invalid) * @param bool $throwException Flag to throw the exception (This only if the parameters are invalid)
* (TRUE: throw the exception; FALSE: returns FALSE) * (TRUE: throw the exception; FALSE: returns FALSE)
* @param string $status The user's status, which can be "ACTIVE", "INACTIVE" or "VACATION"
* *
* @return array Return an array with all Users, ThrowTheException/FALSE otherwise * @return array Return an array with all Users, ThrowTheException/FALSE otherwise
*/ */
@@ -1150,7 +1151,8 @@ class User
$start = null, $start = null,
$limit = null, $limit = null,
$flagRecord = true, $flagRecord = true,
$throwException = true $throwException = true,
$status = null
) { ) {
try { try {
$arrayUser = array(); $arrayUser = array();
@@ -1210,7 +1212,9 @@ class User
$criteria->add($value[0], $value[1], $value[2]); $criteria->add($value[0], $value[1], $value[2]);
} }
} else { } else {
$criteria->add(\UsersPeer::USR_STATUS, 'ACTIVE', \Criteria::EQUAL); if (!is_null($status)) {
$criteria->add(\UsersPeer::USR_STATUS, uppercase($status), \Criteria::EQUAL);
}
} }
if ($flagFilter && trim($arrayWhere['filter']) != '') { if ($flagFilter && trim($arrayWhere['filter']) != '') {

View File

@@ -21,7 +21,7 @@ class User extends Api
* @class AccessControl {@permission PM_USERS,PM_FACTORY} * @class AccessControl {@permission PM_USERS,PM_FACTORY}
* @url GET * @url GET
*/ */
public function index($filter = null, $lfilter = null, $rfilter = null, $start = null, $limit = null) public function index($filter = null, $lfilter = null, $rfilter = null, $start = null, $limit = null, $status = null)
{ {
try { try {
$user = new \ProcessMaker\BusinessModel\User(); $user = new \ProcessMaker\BusinessModel\User();
@@ -32,7 +32,7 @@ class User extends Api
"filterOption" => (!is_null($filter))? "" : ((!is_null($lfilter))? "LEFT" : ((!is_null($rfilter))? "RIGHT" : "")) "filterOption" => (!is_null($filter))? "" : ((!is_null($lfilter))? "LEFT" : ((!is_null($rfilter))? "RIGHT" : ""))
); );
$response = $user->getUsers($arrayFilterData, null, null, $start, $limit, false); $response = $user->getUsers($arrayFilterData, null, null, $start, $limit, false, true, $status);
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response['data'], $this->arrayFieldIso8601); return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response['data'], $this->arrayFieldIso8601);
} catch (\Exception $e) { } catch (\Exception $e) {