From 920706e9b4abd478116b3019c083e8e23afe48c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 May 2010 21:03:09 +0000 Subject: [PATCH] Fix: If user has no permission to see all projects, see only its projects --- htdocs/projet/ganttchart.php | 4 ++-- htdocs/projet/ganttview.php | 22 ++++++++++------------ htdocs/projet/tasks/fiche.php | 5 +++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php index b479a5baf40..0cc466e713f 100644 --- a/htdocs/projet/ganttchart.php +++ b/htdocs/projet/ganttchart.php @@ -153,8 +153,8 @@ function constructGanttLine($array_contacts,$tarr,$task,$project_dependencies,$l for($i=0; $i < $level; $i++) { $name='     '.$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"; } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index f8b97184082..7965a0b6906 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -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); diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index e6c9b9da7d2..73b5eec3805 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -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 ''; print $langs->trans("Ref"); print ''; + // 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 '';