Add resources in gantt
This commit is contained in:
parent
920706e9b4
commit
e7438320e3
@ -561,6 +561,7 @@ ValidateBefore=Card must be validated before using this feature
|
|||||||
Visibility=Visibility
|
Visibility=Visibility
|
||||||
Private=Private
|
Private=Private
|
||||||
Hidden=Hidden
|
Hidden=Hidden
|
||||||
|
Resources=Resources
|
||||||
# Week day
|
# Week day
|
||||||
Day1=Monday
|
Day1=Monday
|
||||||
Day2=Tuesday
|
Day2=Tuesday
|
||||||
|
|||||||
@ -560,6 +560,7 @@ ValidateBefore=La fiche doit être validée pour pouvoir utiliser cette fonction
|
|||||||
Visibility=Visibilité
|
Visibility=Visibilité
|
||||||
Private=Privé
|
Private=Privé
|
||||||
Hidden=Caché
|
Hidden=Caché
|
||||||
|
Resources=Ressources
|
||||||
# Week day
|
# Week day
|
||||||
Day1=Lundi
|
Day1=Lundi
|
||||||
Day2=Mardi
|
Day2=Mardi
|
||||||
|
|||||||
@ -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
|
* 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 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
|
* @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)
|
* 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 userp Return roles on project for this internal user (task id can't be defined)
|
||||||
* @param usert Return roles on task for this user
|
* @param usert Return roles on task for this internal user
|
||||||
* @param projectid Project id to filter on a project
|
* @param projectid Project id to filter on a project
|
||||||
* @param taskid Task id to filter on a task
|
* @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')
|
* @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 */
|
/* 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 ($userp) $sql.= " FROM ".MAIN_DB_PREFIX."projet as pt";
|
||||||
if ($usert) $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
if ($usert) $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
$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 ($userp) $sql.= " AND ec.fk_socpeople = ".$userp->id;
|
||||||
if ($usert) $sql.= " AND ec.fk_socpeople = ".$usert->id;
|
if ($usert) $sql.= " AND ec.fk_socpeople = ".$usert->id;
|
||||||
$sql.= " AND ec.statut = 4";
|
$sql.= " AND ec.statut = 4";
|
||||||
|
$sql.= " AND ctc.source = 'internal'";
|
||||||
if ($projectid)
|
if ($projectid)
|
||||||
{
|
{
|
||||||
if ($userp) $sql.= " AND pt.rowid = ".$projectid;
|
if ($userp) $sql.= " AND pt.rowid = ".$projectid;
|
||||||
@ -595,8 +596,8 @@ class Task extends CommonObject
|
|||||||
if ($userp) $sql.= " ERROR SHOULD NOT HAPPENS";
|
if ($userp) $sql.= " ERROR SHOULD NOT HAPPENS";
|
||||||
if ($usert) $sql.= " AND pt.rowid = ".$taskid;
|
if ($usert) $sql.= " AND pt.rowid = ".$taskid;
|
||||||
}
|
}
|
||||||
|
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
dol_syslog("Task::getUserRolesForProjectsOrTasks sql=".$sql);
|
dol_syslog("Task::getUserRolesForProjectsOrTasks sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -625,10 +626,10 @@ class Task extends CommonObject
|
|||||||
* \brief Return list of id of contacts of task
|
* \brief Return list of id of contacts of task
|
||||||
* \return array Array of id of contacts
|
* \return array Array of id of contacts
|
||||||
*/
|
*/
|
||||||
function getListContactId()
|
function getListContactId($source='internal')
|
||||||
{
|
{
|
||||||
$contactAlreadySelected = array();
|
$contactAlreadySelected = array();
|
||||||
$tab = $this->liste_contact(-1,'internal');
|
$tab = $this->liste_contact(-1,$source);
|
||||||
$num=sizeof($tab);
|
$num=sizeof($tab);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
|
|||||||
@ -103,8 +103,8 @@ $tnums = count($tasks);
|
|||||||
for ($tcursor=0; $tcursor < $tnums; $tcursor++) {
|
for ($tcursor=0; $tcursor < $tnums; $tcursor++) {
|
||||||
$t = $tasks[$tcursor];
|
$t = $tasks[$tcursor];
|
||||||
if ($t["task_parent"] == 0) {
|
if ($t["task_parent"] == 0) {
|
||||||
constructGanttLine($array_contacts,$tasks,$t,$project_dependencies,$level,$project_id);
|
constructGanttLine($tasks,$t,$project_dependencies,$level,$project_id);
|
||||||
findChildGanttLine($array_contacts,$tasks,$t["task_id"],$project_dependencies,$level+1);
|
findChildGanttLine($tasks,$t["task_id"],$project_dependencies,$level+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -120,15 +120,14 @@ else
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function constructGanttLine($array_contacts,$tarr,$task,$project_dependencies,$level=0,$project_id=null){
|
function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_id=null){
|
||||||
$start_date = $task["task_start_date"];
|
$start_date = $task["task_start_date"];
|
||||||
$end_date = $task["task_end_date"];
|
$end_date = $task["task_end_date"];
|
||||||
if (!$end_date) $end_date = $start_date;
|
if (!$end_date) $end_date = $start_date;
|
||||||
$start_date = dol_print_date($start_date,"%m/%d/%Y");
|
$start_date = dol_print_date($start_date,"%m/%d/%Y");
|
||||||
$end_date = dol_print_date($end_date,"%m/%d/%Y");
|
$end_date = dol_print_date($end_date,"%m/%d/%Y");
|
||||||
// Ressources
|
// Resources
|
||||||
$ressources = $array_contacts[$task["task_id"]];
|
$resources = $task["task_resources"];
|
||||||
//$ressources = 'ee'; // TODO Add list of ressources
|
|
||||||
// Define depend (ex: "", "4,13", ...)
|
// Define depend (ex: "", "4,13", ...)
|
||||||
$depend = "\"";
|
$depend = "\"";
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@ -153,18 +152,18 @@ function constructGanttLine($array_contacts,$tarr,$task,$project_dependencies,$l
|
|||||||
for($i=0; $i < $level; $i++) { $name=' '.$name; }
|
for($i=0; $i < $level; $i++) { $name=' '.$name; }
|
||||||
// Add line to gantt
|
// Add line to gantt
|
||||||
$s = "// Add taks id=".$tasks["task_id"]." level = ".$level."\n";
|
$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."', '".$task['task_color']."', '', ".$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'].", '".$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'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));";
|
||||||
echo $s."\n";
|
echo $s."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
function findChildGanttLine($array_contacts,$tarr,$parent,$project_dependencies,$level) {
|
function findChildGanttLine($tarr,$parent,$project_dependencies,$level) {
|
||||||
$n=count( $tarr );
|
$n=count( $tarr );
|
||||||
for ($x=0; $x < $n; $x++) {
|
for ($x=0; $x < $n; $x++) {
|
||||||
if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"])
|
if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"])
|
||||||
{
|
{
|
||||||
constructGanttLine($array_contacts,$tarr,$tarr[$x],$project_dependencies,$level,null);
|
constructGanttLine($tarr,$tarr[$x],$project_dependencies,$level,null);
|
||||||
findChildGanttLine($array_contacts,$tarr,$tarr[$x]["task_id"],$project_dependencies,$level+1);
|
findChildGanttLine($tarr,$tarr[$x]["task_id"],$project_dependencies,$level+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,6 +99,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
|
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
$tab='gantt';
|
$tab='gantt';
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ print '<br>';
|
|||||||
// can have a parent that is not affected to him).
|
// can have a parent that is not affected to him).
|
||||||
$tasksarray=$task->getTasksArray(0, 0, $project->id, $socid, 0);
|
$tasksarray=$task->getTasksArray(0, 0, $project->id, $socid, 0);
|
||||||
// We load also tasks limited to a particular user
|
// 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($tasksarray);
|
||||||
//var_dump($tasksrole);
|
//var_dump($tasksrole);
|
||||||
|
|
||||||
@ -193,15 +194,47 @@ if (sizeof($tasksarray)>0)
|
|||||||
$i=0;
|
$i=0;
|
||||||
foreach($tasksarray as $key => $val)
|
foreach($tasksarray as $key => $val)
|
||||||
{
|
{
|
||||||
|
$task->fetch($val->id);
|
||||||
$tasks[$i]['task_id']=$val->id;
|
$tasks[$i]['task_id']=$val->id;
|
||||||
$tasks[$i]['task_parent']=$val->fk_parent;
|
$tasks[$i]['task_parent']=$val->fk_parent;
|
||||||
$tasks[$i]['task_is_group']=0;
|
$tasks[$i]['task_is_group']=0;
|
||||||
$tasks[$i]['task_milestone']=0;
|
$tasks[$i]['task_milestone']=0;
|
||||||
$tasks[$i]['task_percent_complete']=$val->progress;
|
$tasks[$i]['task_percent_complete']=$val->progress;
|
||||||
|
//$tasks[$i]['task_name']=$task->getNomUrl(1);
|
||||||
$tasks[$i]['task_name']=$val->label;
|
$tasks[$i]['task_name']=$val->label;
|
||||||
$tasks[$i]['task_start_date']=$val->date_start;
|
$tasks[$i]['task_start_date']=$val->date_start;
|
||||||
$tasks[$i]['task_end_date']=$val->date_end;
|
$tasks[$i]['task_end_date']=$val->date_end;
|
||||||
$tasks[$i]['task_color']='b4d1ea';
|
$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']='<a href="'.DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$val->id.'" title="'.dol_escape_htmltag($s).'">'.$langs->trans("List").'</a>';
|
||||||
|
//print "xxx".$val->id.$tasks[$i]['task_resources'];
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
//var_dump($tasks);
|
//var_dump($tasks);
|
||||||
|
|||||||
@ -16,7 +16,6 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/projet/jsgantt_language.js.php
|
* \file htdocs/projet/jsgantt_language.js.php
|
||||||
* \brief Fichier de javascript de traduction pour JSGantt
|
* \brief Fichier de javascript de traduction pour JSGantt
|
||||||
@ -53,7 +52,7 @@ i18n["sWeek"] = "<?php echo $langs->transnoentities("Week") ?>";
|
|||||||
i18n["sMonth"] = "<?php echo $langs->transnoentities("Month") ?>";
|
i18n["sMonth"] = "<?php echo $langs->transnoentities("Month") ?>";
|
||||||
i18n["sQuarter"] = "<?php echo $langs->transnoentities("Quarter") ?>";
|
i18n["sQuarter"] = "<?php echo $langs->transnoentities("Quarter") ?>";
|
||||||
i18n["View"] = "<?php echo $langs->transnoentities("View") ?>";
|
i18n["View"] = "<?php echo $langs->transnoentities("View") ?>";
|
||||||
i18n["Resource"] = "<?php echo $langs->transnoentities("Ressource") ?>";
|
i18n["Resource"] = "<?php echo $langs->transnoentities("Resources") ?>";
|
||||||
i18n["Duration"] = "<?php echo $langs->transnoentities("Duration") ?>";
|
i18n["Duration"] = "<?php echo $langs->transnoentities("Duration") ?>";
|
||||||
i18n["Start_Date"] = "<?php echo $langs->transnoentities("DateStart") ?>";
|
i18n["Start_Date"] = "<?php echo $langs->transnoentities("DateStart") ?>";
|
||||||
i18n["End_Date"] = "<?php echo $langs->transnoentities("DateEnd") ?>";
|
i18n["End_Date"] = "<?php echo $langs->transnoentities("DateEnd") ?>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user