Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0
Conflicts: htdocs/expensereport/class/expensereport.class.php htdocs/holiday/class/holiday.class.php htdocs/index.php
This commit is contained in:
commit
45ddde6940
@ -2318,7 +2318,7 @@ class ExpenseReport extends CommonObject
|
|||||||
public function load_state_board()
|
public function load_state_board()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb = array();
|
$this->nb = array();
|
||||||
|
|
||||||
@ -2326,6 +2326,12 @@ class ExpenseReport extends CommonObject
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
||||||
$sql .= " WHERE ex.fk_statut > 0";
|
$sql .= " WHERE ex.fk_statut > 0";
|
||||||
$sql .= " AND ex.entity IN (".getEntity('expensereport').")";
|
$sql .= " AND ex.entity IN (".getEntity('expensereport').")";
|
||||||
|
if (empty($user->rights->expensereport->readall))
|
||||||
|
{
|
||||||
|
$userchildids = $user->getAllChildIds(1);
|
||||||
|
$sql .= " AND (ex.fk_user_author IN (".join(',', $userchildids).")";
|
||||||
|
$sql .= " OR ex.fk_user_validator IN (".join(',', $userchildids)."))";
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -2360,15 +2366,17 @@ class ExpenseReport extends CommonObject
|
|||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
$userchildids = $user->getAllChildIds(1);
|
|
||||||
|
|
||||||
$sql = "SELECT ex.rowid, ex.date_valid";
|
$sql = "SELECT ex.rowid, ex.date_valid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as ex";
|
||||||
if ($option == 'toapprove') $sql .= " WHERE ex.fk_statut = 2";
|
if ($option == 'toapprove') $sql .= " WHERE ex.fk_statut = 2";
|
||||||
else $sql .= " WHERE ex.fk_statut = 5";
|
else $sql .= " WHERE ex.fk_statut = 5";
|
||||||
$sql .= " AND ex.entity IN (".getEntity('expensereport').")";
|
$sql .= " AND ex.entity IN (".getEntity('expensereport').")";
|
||||||
|
if (empty($user->rights->expensereport->readall))
|
||||||
|
{
|
||||||
|
$userchildids = $user->getAllChildIds(1);
|
||||||
$sql .= " AND (ex.fk_user_author IN (".join(',', $userchildids).")";
|
$sql .= " AND (ex.fk_user_author IN (".join(',', $userchildids).")";
|
||||||
$sql .= " OR ex.fk_user_validator IN (".join(',', $userchildids)."))";
|
$sql .= " OR ex.fk_user_validator IN (".join(',', $userchildids)."))";
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -1881,7 +1881,6 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@ -1989,6 +1988,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
{
|
{
|
||||||
$this->errors[] = 'ErrorWhenRunningTrigger';
|
$this->errors[] = 'ErrorWhenRunningTrigger';
|
||||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|||||||
@ -2173,12 +2173,20 @@ class Holiday extends CommonObject
|
|||||||
public function load_state_board()
|
public function load_state_board()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $user;
|
||||||
|
|
||||||
$this->nb = array();
|
$this->nb = array();
|
||||||
|
|
||||||
$sql = "SELECT count(h.rowid) as nb";
|
$sql = "SELECT count(h.rowid) as nb";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
|
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
|
||||||
$sql .= " WHERE h.statut > 1";
|
$sql .= " WHERE h.statut > 1";
|
||||||
$sql .= " AND h.entity IN (".getEntity('holiday').")";
|
$sql .= " AND h.entity IN (".getEntity('holiday').")";
|
||||||
|
if (empty($user->rights->expensereport->read_all))
|
||||||
|
{
|
||||||
|
$userchildids = $user->getAllChildIds(1);
|
||||||
|
$sql.= " AND (h.fk_user IN (".join(',', $userchildids).")";
|
||||||
|
$sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))";
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -2212,14 +2220,16 @@ class Holiday extends CommonObject
|
|||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
$userchildids = $user->getAllChildIds(1);
|
|
||||||
|
|
||||||
$sql = "SELECT h.rowid, h.date_debut";
|
$sql = "SELECT h.rowid, h.date_debut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as h";
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as h";
|
||||||
$sql.= " WHERE h.statut = 2";
|
$sql.= " WHERE h.statut = 2";
|
||||||
$sql.= " AND h.entity IN (".getEntity('holiday').")";
|
$sql.= " AND h.entity IN (".getEntity('holiday').")";
|
||||||
|
if(!$user->rights->expensereport->read_all)
|
||||||
|
{
|
||||||
|
$userchildids = $user->getAllChildIds(1);
|
||||||
$sql.= " AND (h.fk_user IN (".join(',', $userchildids).")";
|
$sql.= " AND (h.fk_user IN (".join(',', $userchildids).")";
|
||||||
$sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))";
|
$sql.= " OR h.fk_validator IN (".join(',', $userchildids)."))";
|
||||||
|
}
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -322,7 +322,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
|
|||||||
include_once $includes[$key]; // Loading a class cost around 1Mb
|
include_once $includes[$key]; // Loading a class cost around 1Mb
|
||||||
|
|
||||||
$board = new $classe($db);
|
$board = new $classe($db);
|
||||||
$board->load_state_board($user);
|
$board->load_state_board();
|
||||||
$boardloaded[$classe] = $board;
|
$boardloaded[$classe] = $board;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user