";
- for ($k = 0 ; $k < $level ; $k++)
+ // If there is filters to use
+ if (is_array($taskrole))
{
- print " ";
+ // If task not legitimate to show, search if a task exists later in tree
+ if (! isset($taskrole[$lines[$i]->id]))
+ {
+ // So search if task has a subtask legitimate to show
+ // FIXME
+ //SearchPLine($foundtaskforuserafter,$lines[$i]->id,$lines,$taskrole);
+ if ($foundtaskforuserlater)
+ {
+ $showlineingray=1; // We will show line but in gray
+ }
+ else
+ {
+ $showline=0; // No reason to show line
+ }
+ }
}
- print $lines[$i]->title;
- print "
\n";
- if ($showproject)
+ if ($showline)
{
+ print "
';
-
- print "\n";
-
- $inc++;
-
- $level++;
- if ($lines[$i]->id) PLines($inc, $lines[$i]->id, $lines, $level, $var, $showproject);
- $level--;
}
else
{
diff --git a/htdocs/project.class.php b/htdocs/project.class.php
index 1f033538368..3232390006b 100644
--- a/htdocs/project.class.php
+++ b/htdocs/project.class.php
@@ -411,7 +411,7 @@ class Project extends CommonObject
}
/**
- * Enter description here...
+ * Return array of role of user for each projects
*
* @param unknown_type $user
* @return unknown
@@ -457,7 +457,7 @@ class Project extends CommonObject
function getTasksArray($usert=0, $userp=0, $mode=0)
{
global $conf;
-
+
$tasks = array();
//print $usert.'-'.$userp;
@@ -514,15 +514,15 @@ class Project extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
+ $tasks[$i]->id = $obj->rowid;
$tasks[$i]->projectid = $obj->projectid;
$tasks[$i]->projectref = $obj->ref;
$tasks[$i]->projectlabel = $obj->title;
- $tasks[$i]->id = $obj->rowid;
$tasks[$i]->title = $obj->title;
$tasks[$i]->fk_parent = $obj->fk_task_parent;
$tasks[$i]->duration = $obj->duration_effective;
- $tasks[$i]->name = $obj->name;
- $tasks[$i]->firstname = $obj->firstname;
+ $tasks[$i]->name = $obj->name; // Name of project leader
+ $tasks[$i]->firstname = $obj->firstname; // Firstname of project leader
$i++;
}
$this->db->free();
diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php
index b5735a56708..9654c00ca54 100644
--- a/htdocs/projet/tasks/fiche.php
+++ b/htdocs/projet/tasks/fiche.php
@@ -223,9 +223,12 @@ else
print '';
print '';
-
- $tasksarray=$projet->getTasksArray($_REQUEST["mode"]=='mine'?$user:0, 0);
-
+ // 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=$projet->getTasksArray(0, 0, 0);
+ // We load also tasks limited to a particular user
+ $tasksrole=($_REQUEST["mode"]=='mine' ? $projet->getTasksRoleForUser($user) : '');
/*
* Actions
@@ -250,12 +253,13 @@ else
print '
';
print '
';
if ($projectstatic->id) print '
'.$langs->trans("Project").'
';
- print '
'.$langs->trans("RefTask").'
';
+ print '
'.$langs->trans("RefTask").'
';
print '
'.$langs->trans("LabelTask").'
';
print '
'.$langs->trans("TimeSpent").'
';
print "
\n";
+ // Show all lines in taskarray (recusrive function to go down on tree)
$j=0;
- $nboftaskshown=PLines($j, 0, $tasksarray, $level, true, 0);
+ $nboftaskshown=PLines($j, 0, $tasksarray, $level, true, 0, $tasksrole);
print "
";
-
}
}
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
new file mode 100644
index 00000000000..25fb1f52ab1
--- /dev/null
+++ b/htdocs/projet/tasks/time.php
@@ -0,0 +1,172 @@
+
+ * Copyright (C) 2006-2009 Laurent Destailleur
+ *
+ * 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/tasks/task.php
+ * \ingroup projet
+ * \brief Fiche t�ches d'un projet
+ * \version $Id$
+ */
+
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
+
+if (!$user->rights->projet->lire) accessforbidden();
+
+/*
+ * Actions
+ */
+
+
+
+
+
+/*
+ * View
+ */
+
+llxHeader("",$langs->trans("Task"));
+
+$html = new Form($db);
+
+$projectstatic = new Project($db);
+
+
+if ($_GET["id"] > 0)
+{
+ /*
+ * Fiche projet en mode visu
+ *
+ */
+ $task = new Task($db);
+ if ($task->fetch($_GET["id"]) >= 0 )
+ {
+ $projet = new Project($db);
+ $result=$projet->fetch($task->fk_projet);
+ if (! empty($projet->socid)) $projet->societe->fetch($projet->socid);
+
+ $head=task_prepare_head($task);
+
+ dol_fiche_head($head, 'time', $langs->trans("Task"));
+
+ if ($mesg) print $mesg.' ';
+
+ print '';
+ print '';
+
+
+ /*
+ * Actions
+ */
+ print '