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

Removed a TODO

parent bcadc33e
No related branches found
No related tags found
No related merge requests found
...@@ -344,13 +344,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t ...@@ -344,13 +344,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
{ {
// Project ref // Project ref
print "<td>"; print "<td>";
if ($showlineingray) print '<i>'; //if ($showlineingray) print '<i>';
$projectstatic->id=$lines[$i]->fk_project; $projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref; $projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public; $projectstatic->public=$lines[$i]->public;
if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1); if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
else print $projectstatic->getNomUrl(1,'nolink'); else print $projectstatic->getNomUrl(1,'nolink');
if ($showlineingray) print '</i>'; //if ($showlineingray) print '</i>';
print "</td>"; print "</td>";
// Project status // Project status
......
...@@ -575,25 +575,60 @@ class Task extends CommonObject ...@@ -575,25 +575,60 @@ class Task extends CommonObject
if ($mode == 0) if ($mode == 0)
{ {
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if ($filteronprojuser > 0)
{
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc";
}
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; $sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
if ($filterontaskuser > 0)
{
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
}
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND t.fk_projet = p.rowid"; $sql.= " AND t.fk_projet = p.rowid";
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
if ($filteronprojuser > 0)
{
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc";
}
if ($filterontaskuser > 0)
{
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2";
$sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2";
}
else
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid";
}
$sql.= " WHERE p.entity = ".$conf->entity; $sql.= " WHERE p.entity = ".$conf->entity;
} }
else return 'BadValueForParameterMode'; else return 'BadValueForParameterMode';
if ($filteronprojuser > 0) if ($filteronprojuser > 0)
{ {
// TODO $sql.= " AND p.rowid = ec.element_id";
$sql.= " AND ctc.rowid = ec.fk_c_type_contact";
$sql.= " AND ctc.element = 'project'";
$sql.= " AND ec.fk_socpeople = ".$filteronprojuser;
$sql.= " AND ec.statut = 4";
$sql.= " AND ctc.source = 'internal'";
} }
if ($filterontaskuser > 0) if ($filterontaskuser > 0)
{ {
// TODO $sql.= " AND t.fk_projet = p.rowid";
$sql.= " AND p.rowid = ec2.element_id";
$sql.= " AND ctc2.rowid = ec2.fk_c_type_contact";
$sql.= " AND ctc2.element = 'project_task'";
$sql.= " AND ec2.fk_socpeople = ".$filterontaskuser;
$sql.= " AND ec2.statut = 4";
$sql.= " AND ctc2.source = 'internal'";
} }
if ($socid) $sql.= " AND p.fk_soc = ".$socid; if ($socid) $sql.= " AND p.fk_soc = ".$socid;
if ($projectid) $sql.= " AND p.rowid in (".$projectid.")"; if ($projectid) $sql.= " AND p.rowid in (".$projectid.")";
......
...@@ -318,7 +318,6 @@ if ($resql) ...@@ -318,7 +318,6 @@ if ($resql)
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
if ($mine) $search_user=$user->id;
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': ';
$includeonly=''; $includeonly='';
......
...@@ -128,7 +128,7 @@ if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosea ...@@ -128,7 +128,7 @@ if ($search_all) $morewherefilter.=natural_search(array_keys($fieldstosea
if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref); if ($search_task_ref) $morewherefilter.=natural_search('t.ref', $search_task_ref);
if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label); if ($search_task_label) $morewherefilter.=natural_search('t.label', $search_task_label);
$tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, $search_task_user); $tasksarray=$taskstatic->getTasksArray(0, 0, $projectstatic->id, $socid, 0, $search_project, $search_status, $morewherefilter, $search_project_user, 0); // We don't use filter on task user. Because sometimes a task is assigned but not the parent one and we want to show also parent, so filtering is done during output
$tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, ($tuser->id?$tuser:null), $projectstatic->id, 0, $search_status); // We load also tasks limited to a particular user $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, ($tuser->id?$tuser:null), $projectstatic->id, 0, $search_status); // We load also tasks limited to a particular user
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
...@@ -156,7 +156,6 @@ $moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_use ...@@ -156,7 +156,6 @@ $moreforfilter.=$form->select_dolusers($search_project_user, 'search_project_use
$moreforfilter.='</div>'; $moreforfilter.='</div>';
// If the user can view users // If the user can view users
if ($mine) $search_task_user=$user->id;
$moreforfilter.='<div class="divsearchfield">'; $moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': '; $moreforfilter.=$langs->trans('TasksWithThisUserAsContact'). ': ';
$includeonly=''; $includeonly='';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment