Merge pull request #15255 from frederic34/holidayfetchusers
cut fonction in two parts
This commit is contained in:
commit
7d813ad563
@ -1600,12 +1600,28 @@ class Holiday extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetchUsers($stringlist = true, $type = true, $filters = '')
|
public function fetchUsers($stringlist = true, $type = true, $filters = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
|
||||||
|
|
||||||
if ($stringlist)
|
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;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::fetchUsersById", LOG_DEBUG);
|
||||||
|
|
||||||
if ($type)
|
if ($type)
|
||||||
{
|
{
|
||||||
// If user of Dolibarr
|
// If user of Dolibarr
|
||||||
@ -1692,8 +1708,21 @@ 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)
|
||||||
{
|
{
|
||||||
@ -1797,7 +1826,6 @@ class Holiday extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
@ -1805,7 +1833,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 Array of user ids
|
* @return array|int Array of user ids
|
||||||
*/
|
*/
|
||||||
public function fetch_users_approver_holiday()
|
public function fetch_users_approver_holiday()
|
||||||
{
|
{
|
||||||
@ -1936,7 +1964,8 @@ class Holiday extends CommonObject
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
{
|
{
|
||||||
$error++; $this->errors[] = "Error ".$this->db->lasterror();
|
$error++;
|
||||||
|
$this->errors[] = "Error ".$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -2007,7 +2036,7 @@ class Holiday extends CommonObject
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On liste les résultats et on les ajoutent dans le tableau
|
// On liste les résultats et on les ajoute dans le tableau
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user