diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 5494a9ccb70a7d0f05d4c383db2a58d263f88c25..dfcfce9e36996380c477e4fcfc377f25c9f9da3f 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -283,13 +283,14 @@ function dolibarr_fiche_head($links, $active='0', $title='', $notab=0)
 }
 
 /**
- *	\brief      Affiche le header d'une fiche
- *	\param	    links		Tableau de titre d'onglets
- *	\param	    active      0=onglet non actif, 1=onglet actif
- *	\param      title       Titre tabelau ("" par defaut)
+ *	\brief      Show tab header of a card
+ *	\param	    links		Array of tabs
+ *	\param	    active      Active tab name
+ *	\param      title       Title
  *	\param      notab		0=Add tab header, 1=no tab header
+ * 	\param		picto		Add a picto on tab titel
  */
-function dol_fiche_head($links, $active='0', $title='', $notab=0)
+function dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='')
 {
 	print "\n".'<div class="tabs">'."\n";
 
@@ -298,6 +299,7 @@ function dol_fiche_head($links, $active='0', $title='', $notab=0)
 	{
 		$limittitle=30;
 		print '<a class="tabTitle">';
+		if ($picto) print img_object('',$picto).' ';
 		print
 		((!defined('MAIN_USE_SHORT_TITLE')) || (defined('MAIN_USE_SHORT_TITLE') &&  MAIN_USE_SHORT_TITLE))
 		? dol_trunc($title,$limittitle)
diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php
index a3fbec0c171dab7122cb6250d07931e30bfb43d1..b417fd5059075563e14e8ec32fcebff4f7606f50 100644
--- a/htdocs/lib/project.lib.php
+++ b/htdocs/lib/project.lib.php
@@ -141,7 +141,16 @@ function select_projects($socid, $selected='', $htmlname='projectid')
 }
 
 
-
+/**
+ * Enter description here...
+ *
+ * @param unknown_type $inc
+ * @param unknown_type $parent
+ * @param unknown_type $lines
+ * @param unknown_type $level
+ * @param unknown_type $tasksrole
+ * @return unknown
+ */
 function PLinesb(&$inc, $parent, $lines, &$level, $tasksrole)
 {
 	global $user, $bc, $langs;
@@ -220,12 +229,12 @@ function PLinesb(&$inc, $parent, $lines, &$level, $tasksrole)
 /**
  * Show task lines with a particular parent
  * @param 	$inc				Counter that count number of lines legitimate to show (for return)
- * @param 	$parent				Id of parent task
+ * @param 	$parent				Id of parent task to start
  * @param 	$lines				Array of all tasks
  * @param 	$level				Level of task
  * @param 	$var				Color
  * @param 	$showproject		Show project columns
- * @param	$linesfiltered		''=No filter on users, Array=Shown tasks filtered on a particular user, the array contains tasks filtered
+ * @param	$taskrole			Array of task filtered on a particular user
  */
 function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskrole='')
 {
@@ -234,6 +243,7 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
 	$lastprojectid=0;
 
 	$projectstatic = new Project($db);
+	$taskstatic = new Task($db);
 
 	for ($i = 0 ; $i < sizeof($lines) ; $i++)
 	{
@@ -257,13 +267,14 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
 			// If there is filters to use
 			if (is_array($taskrole))
 			{
-				// If task not legitimate to show, search if a task exists later in tree
-				if (! isset($taskrole[$lines[$i]->id]))
+				// If task not legitimate to show, search if a legitimate task exists later in tree
+				if (! isset($taskrole[$lines[$i]->id]) && $lines[$i]->id != $lines[$i]->fk_parent)
 				{
 					// So search if task has a subtask legitimate to show
-					// FIXME
-					//SearchPLine($foundtaskforuserafter,$lines[$i]->id,$lines,$taskrole);
-					if ($foundtaskforuserlater)
+					$foundtaskforuserdeeper=0;
+					SearchTaskInChild($foundtaskforuserdeeper,$lines[$i]->id,$lines,$taskrole);
+					//print '$foundtaskforuserpeeper='.$foundtaskforuserdeeper.'<br>';
+					if ($foundtaskforuserdeeper > 0)
 					{
 						$showlineingray=1;		// We will show line but in gray
 					}
@@ -279,25 +290,38 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
 				print "<tr ".$bc[$var].">\n";
 
 				print '<td>';
-				if (! $showlineingray) print '<a href="task.php?id='.$lines[$i]->id.'">';
-				print $lines[$i]->id;
-				if (! $showlineingray) print '</a>';
+				if ($showlineingray)
+				{
+					print '<i>'.$lines[$i]->id.'</i>';
+				}
+				else
+				{
+					$taskstatic->id=$lines[$i]->id;
+					$taskstatic->ref=$lines[$i]->id;
+					print $taskstatic->getNomUrl(1);
+				}
 				print '</td>';
 
 				print "<td>";
+				if ($showlineingray) print '<i>';
+				else print '<a href="task.php?id='.$lines[$i]->id.'">';
 				for ($k = 0 ; $k < $level ; $k++)
 				{
 					print "&nbsp;&nbsp;&nbsp;";
 				}
 				print $lines[$i]->title;
+				if ($showlineingray) print '</i>';
+				else print '</a>';
 				print "</td>\n";
 
 				if ($showproject)
 				{
 					print "<td>";
+					if ($showlineingray) print '<i>';
 					$projectstatic->id=$lines[$i]->projectid;
 					$projectstatic->ref=$lines[$i]->projectref;
 					print $projectstatic->getNomUrl(1);
+					if ($showlineingray) print '</i>';
 					print "</td>";
 				}
 
@@ -305,9 +329,11 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
 				$minutes = round((($lines[$i]->duration - $heure) * 60),0);
 				$minutes = substr("00"."$minutes", -2);
 				print '<td align="right">';
-				if (! $showlineingray) print '<a href="task.php?id='.$lines[$i]->id.'">';
+				if ($showlineingray) print '<i>';
+				else print '<a href="time.php?id='.$lines[$i]->id.'">';
 				print $heure."&nbsp;h&nbsp;".$minutes;
-				if (! $showlineingray) print '</a>';
+				if ($showlineingray) print '</i>';
+				else print '</a>';
 				print '</td>';
 
 				print "</tr>\n";
@@ -328,6 +354,42 @@ function PLines(&$inc, $parent, &$lines, &$level, $var, $showproject=1, &$taskro
 	return $inc;
 }
 
+
+/**
+ * Search in task lines with a particular parent if there is a task for a particular user (in taskrole)
+ * @param 	$inc				Counter that count number of lines legitimate to show (for return)
+ * @param 	$parent				Id of parent task to start
+ * @param 	$lines				Array of all tasks
+ * @param	$taskrole			Array of task filtered on a particular user
+ * @return	int					1 if there is
+ */
+function SearchTaskInChild(&$inc, $parent, &$lines, &$taskrole)
+{
+	//print 'Search in line with parent id = '.$parent.'<br>';
+	for ($i = 0 ; $i < sizeof($lines) ; $i++)
+	{
+		// Process line $lines[$i]
+		if ($lines[$i]->fk_parent == $parent && $lines[$i]->id != $lines[$i]->fk_parent)
+		{
+			// If task is legitimate to show, no more need to search deeper
+			if (isset($taskrole[$lines[$i]->id]))
+			{
+				//print 'Found a legitimate task id='.$lines[$i]->id.'<br>';
+				$inc++;
+				return $inc;
+			}
+
+			SearchTaskInChild($inc, $lines[$i]->id, $lines, $taskrole);
+			//print 'Found inc='.$inc.'<br>';
+
+			if ($inc > 0) return $inc;
+		}
+	}
+
+	return $inc;
+}
+
+
 /**
  * Clean task not linked to a parent
  * @param unknown_type $db
diff --git a/htdocs/project.class.php b/htdocs/project.class.php
index 3232390006b5466c5169bcb830d08241c4cc5dcb..0fa3b46065cc39d2ed648af73736412e1fb78af3 100644
--- a/htdocs/project.class.php
+++ b/htdocs/project.class.php
@@ -422,8 +422,10 @@ class Project extends CommonObject
 
 		/* Liste des taches et role sur la tache du user courant dans $tasksrole */
 		$sql = "SELECT a.fk_projet_task, a.role";
-		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_actors as a";
-		$sql .= " WHERE a.fk_user = ".$user->id;
+		$sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_actors as a";
+		$sql.= " WHERE pt.rowid = a.fk_projet_task";
+		$sql.= " AND a.fk_user = ".$user->id;
+		if ($this->id) $sql.= " AND pt.fk_projet =".$this->id;
 
 		$resql = $this->db->query($sql);
 		if ($resql)
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 42c1efd249918b6c07e51fbdefa4711df1cc24fe..69877390f2bb82af492fd4c3544a67db1fe49202 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -71,7 +71,7 @@ if ($projet->user_resp_id > 0)
 }
 
 $head=project_prepare_head($projet);
-dol_fiche_head($head, 'element', $langs->trans("Project"));
+dol_fiche_head($head, 'element', $langs->trans("Project"),0,'project');
 
 
 print '<table class="border" width="100%">';
diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php
index a2b8ba04e7dca3299c7412041e650db08786bd10..9065b8a8617013e7c219746407b1436d9c27e635 100644
--- a/htdocs/projet/fiche.php
+++ b/htdocs/projet/fiche.php
@@ -197,7 +197,7 @@ else
 	if ($projet->user_resp_id > 0) $result=$projet->fetch_user($projet->user_resp_id);
 
 	$head=project_prepare_head($projet);
-	dol_fiche_head($head, 'project', $langs->trans("Project"));
+	dol_fiche_head($head, 'project', $langs->trans("Project"),0,'project');
 
 	if ($_GET["action"] == 'delete')
 	{
diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php
index 9654c00ca54fc4db056fce640570e876b178c36a..9307199e49277dcc9021178df88b6b6c83387fee 100644
--- a/htdocs/projet/tasks/fiche.php
+++ b/htdocs/projet/tasks/fiche.php
@@ -1,4 +1,4 @@
-<?php
+ <?php
 /* Copyright (C) 2005      Rodolphe Quiedeville <rodolphe@quiedeville.org>
  * Copyright (C) 2004-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
  * Copyright (C) 2005-2009 Regis Houssin        <regis@dolibarr.fr>
@@ -186,7 +186,7 @@ else
 	if ($_REQUEST["mode"]=='mine') $tab='mytasks';
 
 	$head=project_prepare_head($projet);
-	dol_fiche_head($head, $tab, $langs->trans("Project"));
+	dol_fiche_head($head, $tab, $langs->trans("Project"),0,'project');
 
 	$param=($_REQUEST["mode"]=='mine'?'&mode=mine':'');
 
@@ -223,13 +223,6 @@ else
 	print '</form>';
 	print '</div>';
 
-	// 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,6 +243,14 @@ else
 	print '</div>';
 
 	print '<br>';
+
+	// 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) : '');
+
 	print '<table class="noborder" width="100%">';
 	print '<tr class="liste_titre">';
 	if ($projectstatic->id) print '<td>'.$langs->trans("Project").'</td>';
@@ -261,11 +262,18 @@ else
 	$j=0;
 	$nboftaskshown=PLines($j, 0, $tasksarray, $level, true, 0, $tasksrole);
 	print "</table>";
+
 	print '</div>';
 
-	if ($nboftaskshown < sizeof($tasksarray))
+	// Test if database is clean. If not we clean it.
+	//print '$nboftaskshown='.$nboftaskshown.' sizeof($tasksarray)='.sizeof($tasksarray).' sizeof($tasksrole)='.sizeof($tasksrole).'<br>';
+	if ($_REQUEST["mode"]=='mine')
+	{
+		if ($nboftaskshown < sizeof($tasksrole)) clean_orphelins($db);
+	}
+	else
 	{
-		clean_orphelins($db);
+		if ($nboftaskshown < sizeof($tasksarray)) clean_orphelins($db);
 	}
 }
 
diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php
index 4613f2928897add20d3a71c7679280c05452063c..5d88989c4e285fd26a9eb87a7651cce55d51a086 100644
--- a/htdocs/projet/tasks/index.php
+++ b/htdocs/projet/tasks/index.php
@@ -79,22 +79,28 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorde
 
 
 $projet = new Project($db);
-$tasksarray=$projet->getTasksArray($_GET["mode"]=='mine'?$user: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) : '');
+
 print '<table class="noborder" width="100%">';
 print '<tr class="liste_titre">';
-print '<td>'.$langs->trans("Task").'</td>';
-print '<td>'.$langs->trans("Label").'</td>';
+print '<td width="80">'.$langs->trans("RefTask").'</td>';
+print '<td>'.$langs->trans("LabelTask").'</td>';
 print '<td>'.$langs->trans("Project").'</td>';
 print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
 print "</tr>\n";
-
-$level=0;
+// Show all lines in taskarray (recusrive function to go down on tree)
 $j=0;
-PLines($j, 0, $tasksarray, $level, true);
-
+$nboftaskshown=PLines($j, 0, $tasksarray, $level, true, 1, $tasksrole);
 print "</table>";
+
+
 print '</div>';
 
 
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 77779b7ede1ff9aac6774e979e55e96dd449884c..7ca1fd688b5032ae329bc6c56e5578a4f0b10a53 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -86,7 +86,7 @@ if ($_GET["id"] > 0)
 
 		$head=task_prepare_head($task);
 
-		dol_fiche_head($head, 'task', $langs->trans("Task"));
+		dol_fiche_head($head, 'task', $langs->trans("Task"),0,'projecttask');
 
 		if ($mesg) print $mesg.'<br>';
 
@@ -101,7 +101,15 @@ if ($_GET["id"] > 0)
 		print '<input type="hidden" name="action" value="createtask">';
 		print '<table class="border" width="100%">';
 
-		print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$task->id.'</td></tr>';
+		// Ref
+		print '<tr><td width="30%">';
+		print $langs->trans("Ref");
+		print '</td><td colspan="3">';
+		print $html->showrefnav($task,'id','',1,'rowid','ref','','');
+		print '</td>';
+		print '</tr>';
+
+		// Label
 		print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->title.'</td></tr>';
 
 		print '<tr><td>'.$langs->trans("Project").'</td><td>';
@@ -151,10 +159,14 @@ if ($_GET["id"] > 0)
 		 */
 		print '<div class="tabsAction">';
 
-		if ($user->rights->projet->creer)
+		if (!$user->rights->projet->creer)
 		{
 			print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';
 		}
+		else
+		{
+			print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
+		}
 
 		print '</div>';
 
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 25fb1f52ab1d9f7176b478e5abea4d21dda2f316..79aae335b840bdbbd4e38af46b59b8be52fa652d 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -63,7 +63,7 @@ if ($_GET["id"] > 0)
 
 		$head=task_prepare_head($task);
 
-		dol_fiche_head($head, 'time', $langs->trans("Task"));
+		dol_fiche_head($head, 'time', $langs->trans("Task"),0,'projecttask');
 
 		if ($mesg) print $mesg.'<br>';
 
@@ -72,7 +72,14 @@ if ($_GET["id"] > 0)
 		print '<input type="hidden" name="action" value="createtask">';
 		print '<table class="border" width="100%">';
 
-		print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$task->id.'</td></tr>';
+		// Ref
+		print '<tr><td width="30%">';
+		print $langs->trans("Ref");
+		print '</td><td colspan="3">';
+		print $html->showrefnav($task,'id','',1,'rowid','ref','','');
+		print '</td></tr>';
+
+		// Label
 		print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->title.'</td></tr>';
 
 		print '<tr><td>'.$langs->trans("Project").'</td><td>';
diff --git a/htdocs/projet/tasks/who.php b/htdocs/projet/tasks/who.php
index 5ab94eeee5f1131ea22c52aa7117f10dee4d6ff9..36d20f02e4b9ec866d004cbe3a6c17a95abe6b6d 100644
--- a/htdocs/projet/tasks/who.php
+++ b/htdocs/projet/tasks/who.php
@@ -20,7 +20,7 @@
 /**
  *	\file       htdocs/projet/tasks/task.php
  *	\ingroup    projet
- *	\brief      Fiche t�ches d'un projet
+ *	\brief      Fiche t�ches d'un projet
  *	\version    $Id$
  */
 
@@ -63,7 +63,7 @@ if ($_GET["id"] > 0)
 
 		$head=task_prepare_head($task);
 
-		dol_fiche_head($head, 'who', $langs->trans("Task"));
+		dol_fiche_head($head, 'who', $langs->trans("Task"),0,'projecttask');
 
 		if ($mesg) print $mesg.'<br>';
 
@@ -72,7 +72,13 @@ if ($_GET["id"] > 0)
 		print '<input type="hidden" name="action" value="createtask">';
 		print '<table class="border" width="100%">';
 
-		print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$task->id.'</td></tr>';
+		// Ref
+		print '<tr><td width="30%">'.$langs->trans("Ref");
+		print '</td><td colspan="3">';
+		print $html->showrefnav($task,'id','',1,'rowid','ref','','');
+		print '</td></tr>';
+
+		// Label
 		print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$task->title.'</td></tr>';
 
 		print '<tr><td>'.$langs->trans("Project").'</td><td>';
diff --git a/htdocs/task.class.php b/htdocs/task.class.php
index fbda91af4d009ed5a5ef4167034de7c1f8c63698..7d74b7d640ef5ceddd67c78456518d7173013981 100644
--- a/htdocs/task.class.php
+++ b/htdocs/task.class.php
@@ -1,5 +1,5 @@
 <?php
-/* Copyright (C) 2008 Laurent Destailleur  <eldy@users.sourceforge.net>
+/* Copyright (C) 2008-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
  *
  * 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
@@ -17,12 +17,12 @@
  */
 
 /**
-        \file       task.class.php
-        \ingroup    project
-        \brief      This file is a CRUD class file for Taks (Create/Read/Update/Delete)
-		\version    $Id$
-		\remarks	Initialy built by build_class_from_table on 2008-09-10 12:41
-*/
+ *      \file       task.class.php
+ *      \ingroup    project
+ *      \brief      This file is a CRUD class file for Taks (Create/Read/Update/Delete)
+ *		\version    $Id$
+ *		\remarks	Initialy built by build_class_from_table on 2008-09-10 12:41
+ */
 
 // Put here all includes required by your class file
 //require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
@@ -31,20 +31,20 @@
 
 
 /**
-        \class      Projet_task
-        \brief      Put here description of your class
-		\remarks	Initialy built by build_class_from_table on 2008-09-10 12:41
-*/
-class Task // extends CommonObject
+ *      \class      Projet_task
+ *      \brief      Put here description of your class
+ *		\remarks	Initialy built by build_class_from_table on 2008-09-10 12:41
+ */
+class Task extends CommonObject
 {
 	var $db;							//!< To store db handler
 	var $error;							//!< To return error code (or message)
 	var $errors=array();				//!< To return several error codes (or messages)
-	//var $element='projet_task';			//!< Id that identify managed objects
-	//var $table_element='projet_task';	//!< Name of table without prefix where object is stored
-    
+	var $element='projet_task';			//!< Id that identify managed objects
+	var $table_element='projet_task';	//!< Name of table without prefix where object is stored
+
     var $id;
-    
+
 	var $fk_projet;
 	var $fk_task_parent;
 	var $title;
@@ -53,20 +53,20 @@ class Task // extends CommonObject
 	var $statut;
 	var $note;
 
-    
 
-	
+
+
     /**
      *      \brief      Constructor
      *      \param      DB      Database handler
      */
-    function Task($DB) 
+    function Task($DB)
     {
         $this->db = $DB;
         return 1;
     }
 
-	
+
     /**
      *      \brief      Create in database
      *      \param      user        	User that create
@@ -77,9 +77,9 @@ class Task // extends CommonObject
     {
     	global $conf, $langs;
 		$error=0;
-    	
+
 		// Clean parameters
-        
+
 		if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet);
 		if (isset($this->fk_task_parent)) $this->fk_task_parent=trim($this->fk_task_parent);
 		if (isset($this->title)) $this->title=trim($this->title);
@@ -88,14 +88,14 @@ class Task // extends CommonObject
 		if (isset($this->statut)) $this->statut=trim($this->statut);
 		if (isset($this->note)) $this->note=trim($this->note);
 
-        
+
 
 		// Check parameters
 		// Put here code to add control on parameters values
-		
+
         // Insert request
 		$sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task(";
-		
+
 		$sql.= "fk_projet,";
 		$sql.= "fk_task_parent,";
 		$sql.= "title,";
@@ -104,9 +104,9 @@ class Task // extends CommonObject
 		$sql.= "statut,";
 		$sql.= "note";
 
-		
+
         $sql.= ") VALUES (";
-        
+
 		$sql.= " ".(! isset($this->fk_projet)?'NULL':"'".$this->fk_projet."'").",";
 		$sql.= " ".(! isset($this->fk_task_parent)?'NULL':"'".$this->fk_task_parent."'").",";
 		$sql.= " ".(! isset($this->title)?'NULL':"'".$this->title."'").",";
@@ -115,24 +115,24 @@ class Task // extends CommonObject
 		$sql.= " ".(! isset($this->statut)?'NULL':"'".$this->statut."'").",";
 		$sql.= " ".(! isset($this->note)?'NULL':"'".$this->note."'")."";
 
-        
+
 		$sql.= ")";
 
 		$this->db->begin();
-		
+
 	   	dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
         $resql=$this->db->query($sql);
     	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
-        
+
 		if (! $error)
         {
             $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task");
-    
+
 			if (! $notrigger)
 			{
 	            // Uncomment this and change MYOBJECT to your own tag if you
 	            // want this action call a trigger.
-	            
+
 	            //// Call triggers
 	            //include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
 	            //$interface=new Interfaces($this->db);
@@ -149,7 +149,7 @@ class Task // extends CommonObject
 			{
 	            dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
 	            $this->error.=($this->error?', '.$errmsg:$errmsg);
-			}	
+			}
 			$this->db->rollback();
 			return -1*$error;
 		}
@@ -160,7 +160,7 @@ class Task // extends CommonObject
 		}
     }
 
-    
+
     /**
      *    \brief      Load object in memory from database
      *    \param      id          id object
@@ -171,7 +171,7 @@ class Task // extends CommonObject
     	global $langs;
         $sql = "SELECT";
 		$sql.= " t.rowid,";
-		
+
 		$sql.= " t.fk_projet,";
 		$sql.= " t.fk_task_parent,";
 		$sql.= " t.title,";
@@ -180,10 +180,10 @@ class Task // extends CommonObject
 		$sql.= " t.statut,";
 		$sql.= " t.note";
 
-		
+
         $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t";
         $sql.= " WHERE t.rowid = ".$id;
-    
+
     	dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
         $resql=$this->db->query($sql);
         if ($resql)
@@ -191,9 +191,10 @@ class Task // extends CommonObject
             if ($this->db->num_rows($resql))
             {
                 $obj = $this->db->fetch_object($resql);
-    
+
                 $this->id    = $obj->rowid;
-                
+                $this->ref   = $obj->rowid;
+
 				$this->fk_projet = $obj->fk_projet;
 				$this->fk_task_parent = $obj->fk_task_parent;
 				$this->title = $obj->title;
@@ -202,10 +203,10 @@ class Task // extends CommonObject
 				$this->statut = $obj->statut;
 				$this->note = $obj->note;
 
-                
+
             }
             $this->db->free($resql);
-            
+
             return 1;
         }
         else
@@ -215,7 +216,7 @@ class Task // extends CommonObject
             return -1;
         }
     }
-    
+
 
     /**
      *      \brief      Update database
@@ -227,9 +228,9 @@ class Task // extends CommonObject
     {
     	global $conf, $langs;
 		$error=0;
-    	
+
 		// Clean parameters
-        
+
 		if (isset($this->fk_projet)) $this->fk_projet=trim($this->fk_projet);
 		if (isset($this->fk_task_parent)) $this->fk_task_parent=trim($this->fk_task_parent);
 		if (isset($this->title)) $this->title=trim($this->title);
@@ -238,14 +239,14 @@ class Task // extends CommonObject
 		if (isset($this->statut)) $this->statut=trim($this->statut);
 		if (isset($this->note)) $this->note=trim($this->note);
 
-        
+
 
 		// Check parameters
 		// Put here code to add control on parameters values
 
         // Update request
         $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET";
-        
+
 		$sql.= " fk_projet=".(isset($this->fk_projet)?$this->fk_projet:"null").",";
 		$sql.= " fk_task_parent=".(isset($this->fk_task_parent)?$this->fk_task_parent:"null").",";
 		$sql.= " title=".(isset($this->title)?"'".addslashes($this->title)."'":"null").",";
@@ -254,22 +255,22 @@ class Task // extends CommonObject
 		$sql.= " statut=".(isset($this->statut)?$this->statut:"null").",";
 		$sql.= " note=".(isset($this->note)?"'".addslashes($this->note)."'":"null")."";
 
-        
+
         $sql.= " WHERE rowid=".$this->id;
 
 		$this->db->begin();
-        
+
 		dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
         $resql = $this->db->query($sql);
     	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
-        
+
 		if (! $error)
 		{
 			if (! $notrigger)
 			{
 	            // Uncomment this and change MYOBJECT to your own tag if you
 	            // want this action call a trigger.
-				
+
 	            //// Call triggers
 	            //include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
 	            //$interface=new Interfaces($this->db);
@@ -278,7 +279,7 @@ class Task // extends CommonObject
 	            //// End call triggers
 	    	}
 		}
-		
+
         // Commit or rollback
 		if ($error)
 		{
@@ -286,7 +287,7 @@ class Task // extends CommonObject
 			{
 	            dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
 	            $this->error.=($this->error?', '.$errmsg:$errmsg);
-			}	
+			}
 			$this->db->rollback();
 			return -1*$error;
 		}
@@ -294,10 +295,10 @@ class Task // extends CommonObject
 		{
 			$this->db->commit();
 			return 1;
-		}		
+		}
     }
-  
-  
+
+
  	/**
 	*   \brief      Delete object in database
     *	\param      user        	User that delete
@@ -308,9 +309,9 @@ class Task // extends CommonObject
 	{
 		global $conf, $langs;
 		$error=0;
-		
+
 		$this->db->begin();
-		
+
 		if ($this->hasChildren() > 0)
 		{
 			dol_syslog(get_class($this)."::delete Can't delete record as it has some child", LOG_WARNING);
@@ -318,30 +319,30 @@ class Task // extends CommonObject
 			$this->db->rollback();
 			return 0;
 		}
-		
+
 		$sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task";
 		$sql.= " WHERE rowid=".$this->id;
-		
+
 		dol_syslog(get_class($this)."::delete sql=".$sql);
 		$resql = $this->db->query($sql);
     	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
-		
+
 		if (! $error)
 		{
 			if (! $notrigger)
 			{
 				// Uncomment this and change MYOBJECT to your own tag if you
 		        // want this action call a trigger.
-				
+
 		        //// Call triggers
 		        //include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
 		        //$interface=new Interfaces($this->db);
 		        //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
 		        //if ($result < 0) { $error++; $this->errors=$interface->errors; }
 		        //// End call triggers
-			}	
+			}
 		}
-		
+
         // Commit or rollback
 		if ($error)
 		{
@@ -349,7 +350,7 @@ class Task // extends CommonObject
 			{
 	            dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
 	            $this->error.=($this->error?', '.$errmsg:$errmsg);
-			}	
+			}
 			$this->db->rollback();
 			return -1*$error;
 		}
@@ -367,10 +368,10 @@ class Task // extends CommonObject
 	function hasChildren()
 	{
 		$ret=0;
-		
+
 		$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."projet_task";
 		$sql.= " WHERE fk_task_parent=".$this->id;
-		
+
 		dol_syslog(get_class($this)."::hasChildren sql=".$sql, LOG_DEBUG);
 		$resql = $this->db->query($sql);
     	if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
@@ -379,17 +380,43 @@ class Task // extends CommonObject
 			$obj=$this->db->fetch_object($resql);
 			if ($obj) $ret=$obj->nb;
 		}
-		
+
 		if (! $error)
 		{
-			return $ret;			
+			return $ret;
 		}
 		else
 		{
 			return -1;
 		}
-	}	
-	
+	}
+
+
+	/**
+	 *	\brief      Renvoie nom clicable (avec eventuellement le picto)
+	 *	\param		withpicto		0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
+	 *	\param		option			Sur quoi pointe le lien
+	 *	\return		string			Chaine avec URL
+	 */
+	function getNomUrl($withpicto=0,$option='')
+	{
+		global $langs;
+
+		$result='';
+
+		$lien = '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$this->id.'">';
+		$lienfin='</a>';
+
+		$picto='projecttask';
+
+		$label=$langs->trans("ShowTask").': '.$this->ref;
+
+		if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
+		if ($withpicto && $withpicto != 2) $result.=' ';
+		if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
+		return $result;
+	}
+
 	/**
 	 *		\brief		Initialise object with example values
 	 *		\remarks	id must be 0 if object instance is a specimen.
@@ -397,7 +424,7 @@ class Task // extends CommonObject
 	function initAsSpecimen()
 	{
 		$this->id=0;
-		
+
 		$this->fk_projet='';
 		$this->fk_task_parent='';
 		$this->title='';
diff --git a/htdocs/theme/auguria/img/folder.png b/htdocs/theme/auguria/img/folder.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..908a6df9348330b2e9aaebcda75d5c6a08b86fef 100644
Binary files a/htdocs/theme/auguria/img/folder.png and b/htdocs/theme/auguria/img/folder.png differ
diff --git a/htdocs/theme/auguria/img/object_project.png b/htdocs/theme/auguria/img/object_project.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..5ea2e846ddfd125708ef8fdc650742f6acc88823 100644
Binary files a/htdocs/theme/auguria/img/object_project.png and b/htdocs/theme/auguria/img/object_project.png differ
diff --git a/htdocs/theme/auguria/img/object_projecttask.png b/htdocs/theme/auguria/img/object_projecttask.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ec85fed9d3b2f6ca50036741eed51f4b0ded557
Binary files /dev/null and b/htdocs/theme/auguria/img/object_projecttask.png differ
diff --git a/htdocs/theme/bluelagoon/img/folder.png b/htdocs/theme/bluelagoon/img/folder.png
new file mode 100644
index 0000000000000000000000000000000000000000..908a6df9348330b2e9aaebcda75d5c6a08b86fef
Binary files /dev/null and b/htdocs/theme/bluelagoon/img/folder.png differ
diff --git a/htdocs/theme/bluelagoon/img/object_project.png b/htdocs/theme/bluelagoon/img/object_project.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..5ea2e846ddfd125708ef8fdc650742f6acc88823 100644
Binary files a/htdocs/theme/bluelagoon/img/object_project.png and b/htdocs/theme/bluelagoon/img/object_project.png differ
diff --git a/htdocs/theme/bluelagoon/img/object_projecttask.png b/htdocs/theme/bluelagoon/img/object_projecttask.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ec85fed9d3b2f6ca50036741eed51f4b0ded557
Binary files /dev/null and b/htdocs/theme/bluelagoon/img/object_projecttask.png differ
diff --git a/htdocs/theme/eldy/img/folder.png b/htdocs/theme/eldy/img/folder.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..908a6df9348330b2e9aaebcda75d5c6a08b86fef 100644
Binary files a/htdocs/theme/eldy/img/folder.png and b/htdocs/theme/eldy/img/folder.png differ
diff --git a/htdocs/theme/eldy/img/object_project.png b/htdocs/theme/eldy/img/object_project.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..5ea2e846ddfd125708ef8fdc650742f6acc88823 100644
Binary files a/htdocs/theme/eldy/img/object_project.png and b/htdocs/theme/eldy/img/object_project.png differ
diff --git a/htdocs/theme/eldy/img/object_projecttask.png b/htdocs/theme/eldy/img/object_projecttask.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ec85fed9d3b2f6ca50036741eed51f4b0ded557
Binary files /dev/null and b/htdocs/theme/eldy/img/object_projecttask.png differ
diff --git a/htdocs/theme/eldy/img/object_task.png b/htdocs/theme/eldy/img/object_task.png
index 82f4dff41b953dd9e0d0318565215b665a709ecc..60c194f1048a75cc1f36c4ebf4394dd1ca91195e 100644
Binary files a/htdocs/theme/eldy/img/object_task.png and b/htdocs/theme/eldy/img/object_task.png differ
diff --git a/htdocs/theme/freelug/img/folder.png b/htdocs/theme/freelug/img/folder.png
new file mode 100644
index 0000000000000000000000000000000000000000..908a6df9348330b2e9aaebcda75d5c6a08b86fef
Binary files /dev/null and b/htdocs/theme/freelug/img/folder.png differ
diff --git a/htdocs/theme/freelug/img/object_project.png b/htdocs/theme/freelug/img/object_project.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..5ea2e846ddfd125708ef8fdc650742f6acc88823 100644
Binary files a/htdocs/theme/freelug/img/object_project.png and b/htdocs/theme/freelug/img/object_project.png differ
diff --git a/htdocs/theme/freelug/img/object_projecttask.png b/htdocs/theme/freelug/img/object_projecttask.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ec85fed9d3b2f6ca50036741eed51f4b0ded557
Binary files /dev/null and b/htdocs/theme/freelug/img/object_projecttask.png differ
diff --git a/htdocs/theme/rodolphe/img/Thumbs.db b/htdocs/theme/rodolphe/img/Thumbs.db
new file mode 100644
index 0000000000000000000000000000000000000000..6e43e1b2cd962bdb595e1cadc275184de248df13
Binary files /dev/null and b/htdocs/theme/rodolphe/img/Thumbs.db differ
diff --git a/htdocs/theme/rodolphe/img/folder.png b/htdocs/theme/rodolphe/img/folder.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..908a6df9348330b2e9aaebcda75d5c6a08b86fef 100644
Binary files a/htdocs/theme/rodolphe/img/folder.png and b/htdocs/theme/rodolphe/img/folder.png differ
diff --git a/htdocs/theme/rodolphe/img/object_project.png b/htdocs/theme/rodolphe/img/object_project.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..5ea2e846ddfd125708ef8fdc650742f6acc88823 100644
Binary files a/htdocs/theme/rodolphe/img/object_project.png and b/htdocs/theme/rodolphe/img/object_project.png differ
diff --git a/htdocs/theme/rodolphe/img/object_projecttask.png b/htdocs/theme/rodolphe/img/object_projecttask.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ec85fed9d3b2f6ca50036741eed51f4b0ded557
Binary files /dev/null and b/htdocs/theme/rodolphe/img/object_projecttask.png differ
diff --git a/htdocs/theme/yellow/img/folder.png b/htdocs/theme/yellow/img/folder.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..908a6df9348330b2e9aaebcda75d5c6a08b86fef 100644
Binary files a/htdocs/theme/yellow/img/folder.png and b/htdocs/theme/yellow/img/folder.png differ
diff --git a/htdocs/theme/yellow/img/object_project.png b/htdocs/theme/yellow/img/object_project.png
index 9e1316935bcc4e9fa30bb8948914fd362662a86b..5ea2e846ddfd125708ef8fdc650742f6acc88823 100644
Binary files a/htdocs/theme/yellow/img/object_project.png and b/htdocs/theme/yellow/img/object_project.png differ
diff --git a/htdocs/theme/yellow/img/object_projecttask.png b/htdocs/theme/yellow/img/object_projecttask.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ec85fed9d3b2f6ca50036741eed51f4b0ded557
Binary files /dev/null and b/htdocs/theme/yellow/img/object_projecttask.png differ