mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-07 01:23:00 +01:00
Merge remote-tracking branch 'origin/3.7' into develop
This commit is contained in:
@@ -141,6 +141,9 @@ class ActionComm extends CommonObject
|
||||
$userownerid=$this->userownerid;
|
||||
$userdoneid=$this->userdoneid;
|
||||
|
||||
// Be sure assigned user array is not empty.
|
||||
if (count($this->userassigned) == 0) $this->userassigned = array('id'=>$userownerid);
|
||||
|
||||
if (! $this->type_id || ! $this->type_code)
|
||||
{
|
||||
$key=empty($this->type_id)?$this->type_code:$this->type_id;
|
||||
@@ -973,7 +976,7 @@ class ActionComm extends CommonObject
|
||||
$sql.= " a.label, a.code, a.note, a.fk_action as type_id,";
|
||||
$sql.= " a.fk_soc,";
|
||||
$sql.= " a.fk_user_author, a.fk_user_mod,";
|
||||
$sql.= " a.fk_user_action, a.fk_user_done,";
|
||||
$sql.= " a.fk_user_action,";
|
||||
$sql.= " a.fk_contact, a.percent as percentage,";
|
||||
$sql.= " a.fk_element, a.elementtype,";
|
||||
$sql.= " a.priority, a.fulldayevent, a.location, a.punctual, a.transparency,";
|
||||
@@ -981,9 +984,11 @@ class ActionComm extends CommonObject
|
||||
$sql.= " s.nom as socname,";
|
||||
$sql.= " c.id as type_id, c.code as type_code, c.libelle";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc";
|
||||
$sql.= " WHERE a.fk_action=c.id";
|
||||
// We must filter on assignement table
|
||||
if ($filters['logint'] || $filters['login']) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql.= " WHERE a.fk_action=c.id";
|
||||
$sql.= " AND a.entity = ".$conf->entity;
|
||||
foreach ($filters as $key => $value)
|
||||
{
|
||||
@@ -993,17 +998,8 @@ class ActionComm extends CommonObject
|
||||
if ($key == 'idfrom') $sql.=" AND a.id >= ".(is_numeric($value)?$value:0);
|
||||
if ($key == 'idto') $sql.=" AND a.id <= ".(is_numeric($value)?$value:0);
|
||||
if ($key == 'project') $sql.=" AND a.fk_project=".(is_numeric($value)?$value:0);
|
||||
if ($key == 'login')
|
||||
{
|
||||
$login=$value;
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND (";
|
||||
$sql.= " a.fk_user_author = ".$userforfilter->id;
|
||||
$sql.= " OR a.fk_user_action = ".$userforfilter->id;
|
||||
$sql.= " OR a.fk_user_done = ".$userforfilter->id;
|
||||
$sql.= ")";
|
||||
}
|
||||
// We must filter on assignement table
|
||||
if ($key == 'logint' || $key == 'login') $sql.= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($key == 'logina')
|
||||
{
|
||||
$logina=$value;
|
||||
@@ -1011,19 +1007,12 @@ class ActionComm extends CommonObject
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_author = ".$userforfilter->id;
|
||||
}
|
||||
if ($key == 'logint')
|
||||
if ($key == 'logint' || $key == 'login')
|
||||
{
|
||||
$logint=$value;
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_action = ".$userforfilter->id;
|
||||
}
|
||||
if ($key == 'logind')
|
||||
{
|
||||
$logind=$value;
|
||||
$userforfilter=new User($this->db);
|
||||
$result=$userforfilter->fetch('',$value);
|
||||
$sql.= " AND a.fk_user_done = ".$userforfilter->id;
|
||||
$sql.= " AND ar.fk_element = ".$userforfilter->id;
|
||||
}
|
||||
}
|
||||
$sql.= " AND a.datep IS NOT NULL"; // To exclude corrupted events and avoid errors in lightning/sunbird import
|
||||
|
||||
Reference in New Issue
Block a user