Revert "cut fonction in two parts"

This commit is contained in:
Laurent Destailleur 2020-11-02 11:46:28 +01:00 committed by GitHub
parent 7bba8a4616
commit c6c13e48dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1599,29 +1599,13 @@ class Holiday extends CommonObject
* @return array|string|int Return an array * @return array|string|int Return an array
*/ */
public function fetchUsers($stringlist = true, $type = true, $filters = '') public function fetchUsers($stringlist = true, $type = true, $filters = '')
{
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
if ($stringlist) {
$this->fetchUsersById($type, $filters);
} else {
$this->fetchUsersByDetail($type, $filters);
}
}
/**
* Get list of Users or list of vacation balance by User Id
*
* @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list.
* @param string $filters Filters
* @return array|string|int Return an array
*/
public function fetchUsersById($type = true, $filters = '')
{ {
global $conf; global $conf;
dol_syslog(get_class($this)."::fetchUsersById", LOG_DEBUG); dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
if ($stringlist)
{
if ($type) if ($type)
{ {
// If user of Dolibarr // If user of Dolibarr
@ -1708,21 +1692,8 @@ class Holiday extends CommonObject
return -1; return -1;
} }
} }
} } else {
// Si faux donc return array
/**
* Get list of Users or list of vacation balance by detail
*
* @param boolean $type If true, read Dolibarr user list, if false, return vacation balance list.
* @param string $filters Filters
* @return array|string|int Return an array
*/
public function fetchUsersByDetail($type = true, $filters = '')
{
global $conf;
dol_syslog(get_class($this)."::fetchUsersByDetail", LOG_DEBUG);
// List for Dolibarr users // List for Dolibarr users
if ($type) if ($type)
{ {
@ -1826,6 +1797,7 @@ class Holiday extends CommonObject
} }
} }
} }
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -1833,7 +1805,7 @@ class Holiday extends CommonObject
* Return list of people with permission to validate leave requests. * Return list of people with permission to validate leave requests.
* Search for permission "approve leave requests" * Search for permission "approve leave requests"
* *
* @return array|int Array of user ids * @return array Array of user ids
*/ */
public function fetch_users_approver_holiday() public function fetch_users_approver_holiday()
{ {
@ -1964,8 +1936,7 @@ class Holiday extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) if (!$resql)
{ {
$error++; $error++; $this->errors[] = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror();
} }
if (!$error) if (!$error)
@ -2036,7 +2007,7 @@ class Holiday extends CommonObject
return 2; return 2;
} }
// On liste les résultats et on les ajoute dans le tableau // On liste les résultats et on les ajoutent dans le tableau
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);