Fix: If user has no permission to see all projects, see only its projects

This commit is contained in:
Laurent Destailleur 2010-05-23 21:03:09 +00:00
parent 8044300ef7
commit 920706e9b4
3 changed files with 17 additions and 14 deletions

View File

@ -153,8 +153,8 @@ function constructGanttLine($array_contacts,$tarr,$task,$project_dependencies,$l
for($i=0; $i < $level; $i++) { $name=' &nbsp; &nbsp; '.$name; }
// Add line to gantt
$s = "// Add taks id=".$tasks["task_id"]." level = ".$level."\n";
//$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', 'b4d1ea', '', ".$task['task_milestone'].", '".$ressources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));";
$s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', 'b4d1ea', '".$link."', ".$task['task_milestone'].", '".$ressources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1".($depend?",".$depend:"")."));";
//$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$ressources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));";
$s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$ressources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));";
echo $s."\n";
}

View File

@ -193,18 +193,16 @@ if (sizeof($tasksarray)>0)
$i=0;
foreach($tasksarray as $key => $val)
{
// if ($val->date_start && $val->date_end)
// {
$tasks[$i]['task_id']=$val->id;
$tasks[$i]['task_parent']=$val->fk_parent;
$tasks[$i]['task_is_group']=0;
$tasks[$i]['task_milestone']=0;
$tasks[$i]['task_percent_complete']=$val->progress;
$tasks[$i]['task_name']=$val->label;
$tasks[$i]['task_start_date']=$val->date_start;
$tasks[$i]['task_end_date']=$val->date_end;
$i++;
// }
$tasks[$i]['task_id']=$val->id;
$tasks[$i]['task_parent']=$val->fk_parent;
$tasks[$i]['task_is_group']=0;
$tasks[$i]['task_milestone']=0;
$tasks[$i]['task_percent_complete']=$val->progress;
$tasks[$i]['task_name']=$val->label;
$tasks[$i]['task_start_date']=$val->date_start;
$tasks[$i]['task_end_date']=$val->date_end;
$tasks[$i]['task_color']='b4d1ea';
$i++;
}
//var_dump($tasks);

View File

@ -42,6 +42,8 @@ if (empty($user->rights->projet->all->lire))
$_POST["mode"]='mine';
$_REQUEST["mode"]='mine';
}
$mine = $_REQUEST['mode']=='mine' ? 1 : 0;
if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $projectid);
@ -222,6 +224,9 @@ else
print '<tr><td width="30%">';
print $langs->trans("Ref");
print '</td><td>';
// Define a complementary filter for search of next/prev ref.
$projectsListId = $project->getProjectsAuthorizedForUser($user,$mine,1);
$project->next_prev_filter=" rowid in (".$projectsListId.")";
print $form->showrefnav($project,'ref','',1,'ref','ref','',$param);
print '</td></tr>';