Skip to content
Snippets Groups Projects
Commit 423120db authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #4876 from atm-alexis/NEW_multientity_for_project

# New # multientity for project
parents 46fe16be c3bdc637
No related branches found
No related tags found
No related merge requests found
......@@ -483,7 +483,7 @@ class FormProjets
if ($linkedtothirdparty) $sql.=", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE ".$projectkey." is null";
if (! empty($socid) && $linkedtothirdparty) $sql.= " AND t.fk_soc=".$socid;
if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND t.entity='.getEntity('project');
if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND t.entity IN ('.getEntity('project',1).')';
if ($linkedtothirdparty) $sql.=" AND s.rowid = t.fk_soc";
if ($sqlfilter) $sql.= " AND ".$sqlfilter;
$sql.= " ORDER BY ref DESC";
......
......@@ -69,7 +69,7 @@ if ($id > 0 || ! empty($ref))
// Security check
$socid=GETPOST('socid');
if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $object->id);
$result = restrictedArea($user, 'projet', $object->id,'projet&project');
// fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
......
......@@ -223,7 +223,7 @@ if ($search_user > 0)
$sql.=", ".MAIN_DB_PREFIX."element_contact as ecp";
}
$sql.= " WHERE p.entity IN (".getEntity('project').')';
$sql.= " WHERE p.entity IN (".getEntity('project',1).')';
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
......
......@@ -235,7 +235,7 @@ if ($search_task_user > 0)
$sql.=", ".MAIN_DB_PREFIX."element_contact as ect";
}
$sql.= " WHERE t.fk_projet = p.rowid";
$sql.= " AND p.entity IN (".getEntity('project').')';
$sql.= " AND p.entity IN (".getEntity('project',1).')';
if (! $user->rights->projet->all->lire) $sql.=" p.rowid IN (".join(',',$projectsListId).")"; // public and assigned to projects, or restricted to company for external users
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment