diff --git a/htdocs/includes/dolibarr_changes.txt b/htdocs/includes/dolibarr_changes.txt
index b51f9cd3470..162be0546e0 100644
--- a/htdocs/includes/dolibarr_changes.txt
+++ b/htdocs/includes/dolibarr_changes.txt
@@ -29,6 +29,16 @@ FPDFI and FPDF_TPL:
* Replaced all sprintf(%0.2f) by sprintf(%0.2F) (Fix bug)
+JSGANTT:
+--------
+* Replace in function JSGantt.taskLink
+var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
+with
+// LDR To open in same window
+//var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
+window.location.href=pRef
+
+
PHP-BARCODE:
------------
If files are replaced by new version, following changes must be done:
diff --git a/htdocs/includes/jsgantt/jsgantt.js b/htdocs/includes/jsgantt/jsgantt.js
index 38dd569eac0..ec6940fd844 100644
--- a/htdocs/includes/jsgantt/jsgantt.js
+++ b/htdocs/includes/jsgantt/jsgantt.js
@@ -1905,9 +1905,9 @@ JSGantt.folder= function (pID,ganttObj) {
JSGantt.show(pID, 1, ganttObj);
if (JSGantt.isIE())
- {JSGantt.findObj('group_'+pID).innerText = '–';}
+ {JSGantt.findObj('group_'+pID).innerText = '�';}
else
- {JSGantt.findObj('group_'+pID).textContent = '–';}
+ {JSGantt.findObj('group_'+pID).textContent = '�';}
}
@@ -1979,7 +1979,7 @@ JSGantt.show = function (pID, pTop, ganttObj) {
} else {
if (JSGantt.isIE()) { // IE;
- if( JSGantt.findObj('group_'+pID).innerText == '–') {
+ if( JSGantt.findObj('group_'+pID).innerText == '�') {
JSGantt.findObj('child_'+vID).style.display = "";
JSGantt.findObj('childgrid_'+vID).style.display = "";
vList[i].setVisible(1);
@@ -1987,7 +1987,7 @@ JSGantt.show = function (pID, pTop, ganttObj) {
} else {
- if( JSGantt.findObj('group_'+pID).textContent == '–') {
+ if( JSGantt.findObj('group_'+pID).textContent == '�') {
JSGantt.findObj('child_'+vID).style.display = "";
JSGantt.findObj('childgrid_'+vID).style.display = "";
vList[i].setVisible(1);
@@ -2017,7 +2017,9 @@ JSGantt.taskLink = function(pRef,pWidth,pHeight)
if(pWidth) {vWidth =pWidth;} else {vWidth =400;}
if(pHeight) {vHeight=pHeight;} else {vHeight=400;}
- var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
+ // LDR To open in same window
+ //var OpenWindow=window.open(pRef, "newwin", "height="+vHeight+",width="+vWidth);
+ window.location.href=pRef
};
diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang
index 367536bb463..7bd6d3f4894 100755
--- a/htdocs/langs/en_US/projects.lang
+++ b/htdocs/langs/en_US/projects.lang
@@ -76,6 +76,7 @@ DeleteATimeSpent=Delete time spent
ConfirmDeleteATimeSpent=Are you sure you want to delete this time spent ?
DoNotShowMyTasksOnly=See also tasks i am not affected to
ShowMyTasksOnly=View only tasks i am affected to
+TaskRessourceLinks=Ressources
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Project leader
TypeContact_project_external_PROJECTLEADER=Project leader
diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang
index 73281d581df..3e3a990d29b 100755
--- a/htdocs/langs/fr_FR/projects.lang
+++ b/htdocs/langs/fr_FR/projects.lang
@@ -76,6 +76,7 @@ DeleteATimeSpent=Suppression du temps consommé
ConfirmDeleteATimeSpent=Êtes-vous sûr de vouloir supprimer ce temps consommé ?
DoNotShowMyTasksOnly=Voir aussi les taches qui ne me sont pas affectées
ShowMyTasksOnly=Ne voir que les taches qui me sont affectées
+TaskRessourceLinks=Affectation ressources
##### Types de contacts #####
TypeContact_project_internal_PROJECTLEADER=Chef de projet
TypeContact_project_external_PROJECTLEADER=Chef de projet
diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php
index d918b7e310e..b9371d419a3 100644
--- a/htdocs/lib/project.lib.php
+++ b/htdocs/lib/project.lib.php
@@ -92,9 +92,9 @@ function project_prepare_head($object)
$h++;
*/
- if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
+ if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
{
- $head[$h][0] = DOL_URL_ROOT.'/projet/gant/gantview.php?id='.$object->id;
+ $head[$h][0] = DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id;
$head[$h][1] = $langs->trans("Gantt");
$head[$h][2] = 'gantt';
$h++;
@@ -122,7 +122,7 @@ function task_prepare_head($object)
$h++;
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id;
- $head[$h][1] = $langs->trans("Affectations");
+ $head[$h][1] = $langs->trans("TaskRessourceLinks");
$head[$h][2] = 'contact';
$h++;
diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php
new file mode 100644
index 00000000000..1da053952f6
--- /dev/null
+++ b/htdocs/projet/ganttchart.php
@@ -0,0 +1,173 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * \file htdocs/projet/ganttview.php
+ * \ingroup projet
+ * \brief Gantt diagrame of a project
+ * \version $Id$
+ */
+
+?>
+
+
+
+
+idtask,1=>idtasktofinishfisrt))
+ if ($value[0] == $task['task_id']) {
+ $depend.=($count>0?",":"").$value[1];
+ $count ++;
+ }
+ }
+ $depend .= "\"";
+ // Define parent
+ if ($project_id && $level < 0)
+ $parent = 'p'.$project_id;
+ else
+ $parent = $task["task_parent"];
+ // Define percent
+ $percent = $task['task_percent_complete']?$task['task_percent_complete']:0;
+ // Link
+ $link=DOL_URL_ROOT.'/projet/tasks/task?id='.$task["task_id"];
+ // Name
+ $name=$task['task_name'];
+ 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:"")."));";
+ echo $s."\n";
+}
+
+function findChildGanttLine($array_contacts,$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);
+ }
+ }
+}
+
+?>
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
new file mode 100644
index 00000000000..50661deaeb4
--- /dev/null
+++ b/htdocs/projet/ganttview.php
@@ -0,0 +1,206 @@
+
+ * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2005-2010 Regis Houssin
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * \file htdocs/projet/ganttview.php
+ * \ingroup projet
+ * \brief Gantt diagrame of a project
+ * \version $Id$
+ */
+
+define('DISABLE_PROTOTYPE',1);
+define('DISABLE_SCRIPTACULOUS',1);
+define('DISABLE_PWC',1);
+
+require ("../main.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
+require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
+
+$projectid='';
+$projectid=isset($_REQUEST["id"])?$_REQUEST["id"]:$_POST["id"];
+
+// Security check
+if ($user->societe_id) $socid=$user->societe_id;
+$result = restrictedArea($user, 'projet', $projectid);
+
+$userAccess=0;
+
+$langs->load("users");
+$langs->load("projects");
+
+
+/*
+ * Actions
+ */
+
+
+/*
+ * View
+ */
+
+$arrayofcss=array(
+'/includes/jsgantt/jsgantt.css'
+);
+
+$arrayofjs=array(
+'/includes/jsgantt/jsgantt.js',
+'/includes/jquery/jquery.min.js',
+);
+
+
+$form=new Form($db);
+$formother=new FormOther($db);
+
+$help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
+llxHeader("",$langs->trans("Tasks"),$help_url,'',0,0,$arrayofjs,$arrayofcss);
+
+$task = new Task($db);
+
+$id = $_REQUEST['id'];
+$ref= $_GET['ref'];
+if ($id > 0 || ! empty($ref))
+{
+ $project = new Project($db);
+ $project->fetch($_REQUEST["id"],$_GET["ref"]);
+ if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
+
+ // To verify role of users
+ $userAccess = $project->restrictedProjectArea($user);
+}
+
+
+
+$userstatic=new User($db);
+
+$tab='gantt';
+
+$head=project_prepare_head($project);
+dol_fiche_head($head, $tab, $langs->trans("Project"),0,($project->public?'projectpub':'project'));
+
+$param=($_REQUEST["mode"]=='mine'?'&mode=mine':'');
+
+print '';
+
+// Ref
+print '| ';
+print $langs->trans("Ref");
+print ' | ';
+print $form->showrefnav($project,'ref','',1,'ref','ref','',$param);
+print ' |
';
+
+print '| '.$langs->trans("Label").' | '.$project->title.' |
';
+
+print '| '.$langs->trans("Company").' | ';
+if (! empty($project->societe->id)) print $project->societe->getNomUrl(1);
+else print ' ';
+print ' | ';
+print '
';
+
+// Visibility
+print '| '.$langs->trans("Visibility").' | ';
+if ($project->public) print $langs->trans('SharedProject');
+else print $langs->trans('PrivateProject');
+print ' |
';
+
+// Statut
+print '| '.$langs->trans("Status").' | '.$project->getLibStatut(4).' |
';
+
+print '
';
+
+print '';
+
+
+/*
+ * Actions
+ */
+/*
+print '';
+
+print '
';
+*/
+
+
+// Get list of tasks in tasksarray and taskarrayfiltered
+// We need all tasks (even not limited to a user because a task to user
+// 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) : '');
+//var_dump($tasksarray);
+//var_dump($tasksrole);
+
+
+// Show Gant diagram from $taskarray using JSGantt
+
+$dateformat=$langs->trans("FormatDateShort");
+$dateformat=strtolower($langs->trans("FormatDateShortJava"));
+$array_contacts=array();
+$tasks=array();
+$project_dependencies=array();
+$project_id=$project->id;
+$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++;
+// }
+}
+//var_dump($tasks);
+
+print "\n";
+print ''."\n";
+include_once(DOL_DOCUMENT_ROOT.'/projet/ganttchart.php');
+print '
'."\n";
+
+
+$db->close();
+
+llxFooter('$Date$ - $Revision$');
+?>