Update task.class.php

This commit is contained in:
Laurent Destailleur 2021-05-25 19:54:09 +02:00 committed by GitHub
parent 9d6e93fd01
commit 3dfb22b05e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1986,7 +1986,8 @@ class Task extends CommonObject
global $conf, $langs;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
$socid = $user->socid;
//$socid = $user->socid;
$socid = 0;
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid);
@ -2007,10 +2008,7 @@ class Task extends CommonObject
$sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")";
}
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if ($socid) {
$sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")";
}
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")";
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
// if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";