diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 961d37ceee7..2325acea0fe 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -561,6 +561,7 @@ ValidateBefore=Card must be validated before using this feature Visibility=Visibility Private=Private Hidden=Hidden +Resources=Resources # Week day Day1=Monday Day2=Tuesday diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 064f7c1a9dd..42edb1411b4 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -560,6 +560,7 @@ ValidateBefore=La fiche doit être validée pour pouvoir utiliser cette fonction Visibility=Visibilité Private=Privé Hidden=Caché +Resources=Ressources # Week day Day1=Lundi Day2=Mardi diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 2cbbae9d386..1fa94ce97d8 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -447,7 +447,7 @@ class Task extends CommonObject } /** - * Return list of task for all projects or for one particular project + * Return list of tasks for all projects or for one particular project * Sort order is on project, TODO then of position of task, and last on title of first level task * @param usert Object user to limit tasks affected to a particular user * @param userp Object user to limit projects of a particular user and public projects @@ -547,8 +547,8 @@ class Task extends CommonObject /** * Return list of roles for a user for each projects or each tasks (or a particular project or task) - * @param userp Return roles on project for this user (task id can't be defined) - * @param usert Return roles on task for this user + * @param userp Return roles on project for this internal user (task id can't be defined) + * @param usert Return roles on task for this internal user * @param projectid Project id to filter on a project * @param taskid Task id to filter on a task * @return array Array (projectid => 'list of roles for project' or taskid => 'list of roles for task') @@ -573,7 +573,7 @@ class Task extends CommonObject } /* Liste des taches et role sur les projets ou taches */ - $sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code"; + $sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source"; if ($userp) $sql.= " FROM ".MAIN_DB_PREFIX."projet as pt"; if ($usert) $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; @@ -585,6 +585,7 @@ class Task extends CommonObject if ($userp) $sql.= " AND ec.fk_socpeople = ".$userp->id; if ($usert) $sql.= " AND ec.fk_socpeople = ".$usert->id; $sql.= " AND ec.statut = 4"; + $sql.= " AND ctc.source = 'internal'"; if ($projectid) { if ($userp) $sql.= " AND pt.rowid = ".$projectid; @@ -595,8 +596,8 @@ class Task extends CommonObject if ($userp) $sql.= " ERROR SHOULD NOT HAPPENS"; if ($usert) $sql.= " AND pt.rowid = ".$taskid; } - //print $sql; + dol_syslog("Task::getUserRolesForProjectsOrTasks sql=".$sql); $resql = $this->db->query($sql); if ($resql) @@ -625,10 +626,10 @@ class Task extends CommonObject * \brief Return list of id of contacts of task * \return array Array of id of contacts */ - function getListContactId() + function getListContactId($source='internal') { $contactAlreadySelected = array(); - $tab = $this->liste_contact(-1,'internal'); + $tab = $this->liste_contact(-1,$source); $num=sizeof($tab); $i = 0; while ($i < $num) diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php index 0cc466e713f..efdffeab0b7 100644 --- a/htdocs/projet/ganttchart.php +++ b/htdocs/projet/ganttchart.php @@ -103,8 +103,8 @@ $tnums = count($tasks); for ($tcursor=0; $tcursor < $tnums; $tcursor++) { $t = $tasks[$tcursor]; if ($t["task_parent"] == 0) { - constructGanttLine($array_contacts,$tasks,$t,$project_dependencies,$level,$project_id); - findChildGanttLine($array_contacts,$tasks,$t["task_id"],$project_dependencies,$level+1); + constructGanttLine($tasks,$t,$project_dependencies,$level,$project_id); + findChildGanttLine($tasks,$t["task_id"],$project_dependencies,$level+1); } } ?> @@ -120,15 +120,14 @@ else 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:"")."'));"; + //$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$resources."', ".$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'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));"; echo $s."\n"; } -function findChildGanttLine($array_contacts,$tarr,$parent,$project_dependencies,$level) { +function findChildGanttLine($tarr,$parent,$project_dependencies,$level) { $n=count( $tarr ); for ($x=0; $x < $n; $x++) { if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"]) { - constructGanttLine($array_contacts,$tarr,$tarr[$x],$project_dependencies,$level,null); - findChildGanttLine($array_contacts,$tarr,$tarr[$x]["task_id"],$project_dependencies,$level+1); + constructGanttLine($tarr,$tarr[$x],$project_dependencies,$level,null); + findChildGanttLine($tarr,$tarr[$x]["task_id"],$project_dependencies,$level+1); } } } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 7965a0b6906..1b539081e8f 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -99,6 +99,7 @@ if ($id > 0 || ! empty($ref)) $userstatic=new User($db); +$companystatic=new Societe($db); $tab='gantt'; @@ -174,7 +175,7 @@ print '
'; // can have a parent that is not affected to him). $tasksarray=$task->getTasksArray(0, 0, $project->id, $socid, 0); // We load also tasks limited to a particular user -$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$project->id,0) : ''); +//$tasksrole=($_REQUEST["mode"]=='mine' ? $task->getUserRolesForProjectsOrTasks(0,$user,$project->id,0) : ''); //var_dump($tasksarray); //var_dump($tasksrole); @@ -193,15 +194,47 @@ if (sizeof($tasksarray)>0) $i=0; foreach($tasksarray as $key => $val) { + $task->fetch($val->id); $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']=$task->getNomUrl(1); $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'; + $idofusers=$task->getListContactId('internal'); + $idofthirdparty=$task->getListContactId('external'); + $s=''; + if (sizeof($idofusers)>0) + { + $s.=$langs->trans("Internals").': '; + $i=0; + foreach($idofusers as $key => $valid) + { + $userstatic->fetch($valid); + if ($i) $s.=','; + $s.=$userstatic->login; + $i++; + } + } + if (sizeof($idofusers)>0 && (sizeof($idofthirdparty)>0)) $s.=' - '; + if (sizeof($idofusers)>0) + { + $s.=$langs->trans("Externals").': '; + $i=0; + foreach($idofthirdparty as $key => $valid) + { + $companystatic->fetch($valid); + if ($i) $s.=','; + $s.=$companystatic->name; + $i++; + } + } + if ($s) $tasks[$i]['task_resources']=''.$langs->trans("List").''; + //print "xxx".$val->id.$tasks[$i]['task_resources']; $i++; } //var_dump($tasks); diff --git a/htdocs/projet/jsgantt_language.js.php b/htdocs/projet/jsgantt_language.js.php index 889ecf08c2b..a2c785fac8f 100644 --- a/htdocs/projet/jsgantt_language.js.php +++ b/htdocs/projet/jsgantt_language.js.php @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - /** * \file htdocs/projet/jsgantt_language.js.php * \brief Fichier de javascript de traduction pour JSGantt @@ -53,7 +52,7 @@ i18n["sWeek"] = "transnoentities("Week") ?>"; i18n["sMonth"] = "transnoentities("Month") ?>"; i18n["sQuarter"] = "transnoentities("Quarter") ?>"; i18n["View"] = "transnoentities("View") ?>"; -i18n["Resource"] = "transnoentities("Ressource") ?>"; +i18n["Resource"] = "transnoentities("Resources") ?>"; i18n["Duration"] = "transnoentities("Duration") ?>"; i18n["Start_Date"] = "transnoentities("DateStart") ?>"; i18n["End_Date"] = "transnoentities("DateEnd") ?>";