From e2ea5945ddc772a60ef2e5229fbe302c8126bb6b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 5 Apr 2017 14:48:24 +0200
Subject: [PATCH] Work on look and feel v6

---
 htdocs/adherents/class/adherent.class.php |  85 ++++++++---
 htdocs/adherents/list.php                 |   6 +-
 htdocs/categories/photos.php              |  16 +--
 htdocs/categories/traduction.php          |   4 +-
 htdocs/categories/viewcat.php             |   4 +-
 htdocs/compta/bank/ligne.php              |  16 ++-
 htdocs/core/class/commonobject.class.php  |   4 +-
 htdocs/core/class/html.form.class.php     |   4 +-
 htdocs/core/class/html.formfile.class.php |  19 ++-
 htdocs/core/lib/functions.lib.php         |   3 +-
 htdocs/core/tpl/contacts.tpl.php          |   4 +-
 htdocs/main.inc.php                       |   2 +-
 htdocs/projet/card.php                    |  13 +-
 htdocs/projet/class/task.class.php        |  11 ++
 htdocs/projet/contact.php                 |  13 +-
 htdocs/projet/element.php                 |  18 +--
 htdocs/projet/ganttchart.inc.php          |   4 +-
 htdocs/projet/ganttview.php               |  13 +-
 htdocs/projet/tasks.php                   |  11 +-
 htdocs/projet/tasks/contact.php           |  44 +++---
 htdocs/projet/tasks/document.php          |  31 +++-
 htdocs/projet/tasks/note.php              |  31 ++--
 htdocs/projet/tasks/task.php              |  42 ++++--
 htdocs/projet/tasks/time.php              | 163 ++++++++++++----------
 htdocs/user/class/user.class.php          |   4 +-
 25 files changed, 355 insertions(+), 210 deletions(-)

diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index 833b5bf224e..f3dfd857973 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -1570,40 +1570,85 @@ class Adherent extends CommonObject
     /**
      *    	Return clicable name (with picto eventually)
      *
-     *		@param	int		$withpicto		0=No picto, 1=Include picto into link, 2=Only picto
-     *		@param	int		$maxlen			length max libelle
-     *		@param	string	$option			Page lien
+     *		@param	int		$withpictoimg	0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
+     *		@param	int		$maxlen			length max label
+     *		@param	string	$option			Page for link
+     *      @param  string  $mode           ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
+     *      @param  string  $morecss        Add more css on link
      *		@return	string					Chaine avec URL
      */
-    function getNomUrl($withpicto=0,$maxlen=0,$option='card')
+    function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='ref',$morecss='')
     {
-        global $langs;
+        global $conf, $langs;
+
+        if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
+        
+        $result=''; $label='';
+        $link=''; $linkstart=''; $linkend='';
 
-        $result='';
-        $label = '<u>' . $langs->trans("ShowMember") . '</u>';
+        if (! empty($this->photo))
+        {
+            $label.= '<div class="photointooltip">';
+            $label.= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1);
+            $label.= '</div><div style="clear: both;"></div>';
+        }
+        
+        $label.= '<div class="centpercent">';
+        $label.= '<u>' . $langs->trans("Member") . '</u>';
         if (! empty($this->ref))
             $label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
         if (! empty($this->firstname) || ! empty($this->lastname))
             $label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
-        $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
-
-        $link=''; $linkend='';
+        $label.='</div>';
+        
         if ($option == 'card' || $option == 'category')
         {
-            $link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.$linkclose;
-            $linkend='</a>';
+            $link = '<a href="'.DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id.'"';
         }
         if ($option == 'subscription')
         {
-            $link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.$linkclose;
-            $linkend='</a>';
+            $link = '<a href="'.DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id.'"';
         }
-
-        $picto='user';
-
-        if ($withpicto) $result.=($link.img_object('', $picto, 'class="classfortooltip"').$linkend);
-        if ($withpicto && $withpicto != 2) $result.=' ';
-        $result.=$link.(($withpicto != 2) ? ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref) : '').$linkend;
+        
+        $linkclose="";
+        if (empty($notooltip))
+        {
+            if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
+            {
+                $langs->load("users");
+                $label=$langs->trans("ShowUser");
+                $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
+            }
+            $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
+            $linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
+        }
+        
+        $link.=$linkclose.'>';
+        $linkend='</a>';
+        
+        //if ($withpictoimg == -1) $result.='<div class="nowrap">';
+        $result.=$link;
+        if ($withpictoimg)
+        {
+            $paddafterimage='';
+            if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"';
+            // Only picto
+            if ($withpictoimg > 0) $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'</div>';
+            // Picto must be a photo
+            else $picto='<div class="inline-block nopadding valignmiddle'.($morecss?' userimg'.$morecss:'').'"'.($paddafterimage?' '.$paddafterimage:'').'>'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'</div>';
+            $result.=$picto;
+        }
+        if ($withpictoimg > -2 && $withpictoimg != 2)
+        {
+            if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='<div class="inline-block nopadding valignmiddle'.((! isset($this->statut) || $this->statut)?'':' strikefordisabled').($morecss?' usertext'.$morecss:'').'">';
+            if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen);
+            elseif ($mode == 'ref') $result.=$this->id;
+            else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen);
+            if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='</div>';
+        }
+        $result.=$linkend;
+        //if ($withpictoimg == -1) $result.='</div>';
+        
         return $result;
     }
 
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index e492e31b440..4589cdc754f 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -611,6 +611,7 @@ while ($i < min($num, $limit))
 	$memberstatic->statut=$obj->statut;
 	$memberstatic->datefin= $datefin;
 	$memberstatic->socid = $obj->fk_soc;
+	$memberstatic->photo = $obj->photo;
 	
 	if (! empty($obj->fk_soc)) {
 	    $memberstatic->fetch_thirdparty();
@@ -619,8 +620,7 @@ while ($i < min($num, $limit))
 		$companyname=$obj->company;
 	}
 
-	$var=!$var;
-	print "<tr>";
+	print '<tr class="oddeven">';
 	
 	if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
 	{
@@ -631,7 +631,7 @@ while ($i < min($num, $limit))
 	if (! empty($arrayfields['d.ref']['checked'])) 
 	{
    		print "<td>";
-		print $memberstatic->getNomUrl(1);
+		print $memberstatic->getNomUrl(-1);
 		print "</td>\n";
 	}		
 	// Firstname
diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php
index ee03f9f4771..100d2d0d48e 100644
--- a/htdocs/categories/photos.php
+++ b/htdocs/categories/photos.php
@@ -105,7 +105,7 @@ if ($object->id)
 	$head = categories_prepare_head($object,$type);
 
 
-	dol_fiche_head($head, 'photos', $title, 0, 'category');
+	dol_fiche_head($head, 'photos', $title, -1, 'category');
 	
 	$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
 	
@@ -130,6 +130,7 @@ if ($object->id)
 
 	print '<br>';
 	
+	print '<div class="fichecenter">';
 	print '<div class="underbanner clearboth"></div>';
 	print '<table class="border" width="100%">';
 
@@ -146,7 +147,8 @@ if ($object->id)
 	print '</td></tr>';
 
 	print "</table>\n";
-
+    print '</div>';
+    
 	print dol_fiche_end();
 
 
@@ -198,7 +200,7 @@ if ($object->id)
 		$dir = $upload_dir.'/'.$pdir;
 
 		print '<br>';
-		print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
+		print '<table width="100%" valign="top" align="center">';
 
 		foreach ($object->liste_photos($dir) as $key => $obj)
 		{
@@ -255,14 +257,12 @@ if ($object->id)
 			$nbphoto++;
 		}
 
+		print '</table>';
+	
 		if ($nbphoto < 1)
 		{
-			print '<tr align=center valign=middle border=1><td class="photo">';
-			print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
-			print '</td></tr>';
+			print '<div class="opacitymedium">'.$langs->trans("NoPhotoYet")."</div>";
 		}
-
-		print '</table>';
 	}
 }
 else
diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php
index a239b357045..7dbe6325e1d 100644
--- a/htdocs/categories/traduction.php
+++ b/htdocs/categories/traduction.php
@@ -167,7 +167,7 @@ if (! empty($object->multilangs))
     }
 }
 
-dol_fiche_head($head, 'translation', $title, 0, 'category');
+dol_fiche_head($head, 'translation', $title, -1, 'category');
 
 $linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
 
@@ -184,6 +184,7 @@ dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref',
 
 print '<br>';
 
+print '<div class="fichecenter">';
 print '<div class="underbanner clearboth"></div>';
 
 print '<table class="border" width="100%">';
@@ -201,6 +202,7 @@ print $formother->showColor($object->color);
 print '</td></tr>';
 
 print '</table>';
+print '</div>';
 
 dol_fiche_end();
 
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index a1c33c568f3..a256b362361 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -192,7 +192,7 @@ else                                        $title=$langs->trans("Category");
 $head = categories_prepare_head($object,$type);
 
 
-dol_fiche_head($head, 'card', $title, 0, 'category');
+dol_fiche_head($head, 'card', $title, -1, 'category');
 
 $linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
 
@@ -219,6 +219,7 @@ if ($action == 'delete')
 
 print '<br>';
 
+print '<div class="fichecenter">';
 print '<div class="underbanner clearboth"></div>';
 print '<table width="100%" class="border">';
 
@@ -241,6 +242,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label))
 }
 
 print '</table>';
+print '</div>';
 
 dol_fiche_end();
 
diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php
index f403f676f07..f77ac86af7f 100644
--- a/htdocs/compta/bank/ligne.php
+++ b/htdocs/compta/bank/ligne.php
@@ -228,7 +228,6 @@ $tabs = array(
     )
 );
 
-dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
 
 $sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,";
 $sql.= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,";
@@ -269,11 +268,14 @@ if ($result)
         print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
         print '<input type="hidden" name="id" value="'.$acct->id.'">';
 
+        dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account');
+        
         $linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php">'.$langs->trans("BackToList").'</a>';
 
         
         dol_banner_tab($bankline, 'rowid', $linkback);
         
+
         print '<div class="underbanner clearboth"></div>';       
         print '<table class="border" width="100%">';
 
@@ -542,8 +544,10 @@ if ($result)
         print "</tr>";
 
         print "</table>";
-
-        print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
+        
+        dol_fiche_end();
+        
+        print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
 
         print "</form>";
 
@@ -596,7 +600,7 @@ if ($result)
             print '</tr>';
             print '</table>';
 
-			print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
+            print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
 
 			print '</form>';
         }
@@ -606,7 +610,6 @@ if ($result)
     $db->free($result);
 }
 else dol_print_error($db);
-print '</div>';
 
 
 
@@ -641,8 +644,7 @@ if ($result)
     {
         $objp = $db->fetch_object($result);
 
-        $var=!$var;
-        print "<tr ".$bc[$var].">";
+        print '<tr clas"oddeven">';
 
         print "<td>".$objp->label."</td>";
         print "<td align=\"center\"><a href=\"budget.php?bid=".$objp->rowid."\">".$langs->trans("ListBankTransactions")."</a></td>";
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index e6a5b5d6b92..634f27b1985 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -781,7 +781,7 @@ abstract class CommonObject
         $tab=array();
 
         $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact";    // This field contains id of llx_socpeople or id of llx_user
-        if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact";
+        if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact, t.login, t.photo";
         if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid, t.statut as statuscontact";
         $sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
         $sql.= ", tc.source, tc.element, tc.code, tc.libelle";
@@ -815,7 +815,7 @@ abstract class CommonObject
                     $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
                     $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,
 					               'nom'=>$obj->lastname,      // For backward compatibility
-					               'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'statuscontact'=>$obj->statuscontact,
+					               'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'login'=>$obj->login, 'photo'=>$obj->photo, 'statuscontact'=>$obj->statuscontact,
 					               'rowid'=>$obj->rowid, 'code'=>$obj->code, 'libelle'=>$libelle_type, 'status'=>$obj->statuslink, 'fk_c_type_contact'=>$obj->fk_c_type_contact);
                 }
                 else
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 06405f28b01..eba2fda5049 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -4920,7 +4920,7 @@ class Form
         }
         elseif ($typehour=='text' || $typehour=='textselect')
         {
-        	$retstring.='<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled?' disabled':'').' class="flat" value="'.($hourSelected?((int) $hourSelected):'').'">';
+        	$retstring.='<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled?' disabled':'').' class="flat maxwidth50" value="'.($hourSelected?((int) $hourSelected):'').'">';
         }
         else return 'BadValueForParameterTypeHour';
 
@@ -4944,7 +4944,7 @@ class Form
         }
         elseif ($typehour=='text' )
         {
-        	$retstring.='<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled?' disabled':'').' class="flat" value="'.($minSelected?((int) $minSelected):'').'">';
+        	$retstring.='<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled?' disabled':'').' class="flat maxwidth50" value="'.($minSelected?((int) $minSelected):'').'">';
         }
         
         if ($typehour!='text') $retstring.=' '.$langs->trans('MinuteShort');
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 258c2c9c962..3eef315d48a 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1103,19 +1103,16 @@ class FormFile
 			        // Do we have entry into database ?
 			        print '<!-- In database: position='.$filearray[$key]['position'].' -->'."\n";
 					print '<tr id="row-'.($filearray[$key]['rowid']>0?$filearray[$key]['rowid']:'-AFTER'.$lastrowid.'POS'.($i+1)).'" '.$bcdd[$var].'>';
-					print '<td class="tdoverflow">';
+					print '<td class="tdoverflowmax300">';
+					
+					$filepath=$relativepath.$file['name'];
+					
+					if (! $editline) print $this->showPreview($file,$modulepart,$filepath);
 					
 					//print "XX".$file['name'];	//$file['name'] must be utf8
-					print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
+					print '<a class="paddingleft" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
 					if ($forcedownload) print '&attachment=1';
 					if (! empty($object->entity)) print '&entity='.$object->entity;
-					$filepath=$relativepath.$file['name'];
-					/* Restore old code: When file is at level 2+, full relative path (and not only level1) must be into url
-					if ($file['level1name'] <> $object->id)
-						$filepath=$object->id.'/'.$file['level1name'].'/'.$file['name'];
-					else
-						$filepath=$object->id.'/'.$file['name'];
-					*/
 					print '&file='.urlencode($filepath);
 					print '">';
 
@@ -1135,10 +1132,10 @@ class FormFile
 					    print '</a>';
 					}
 					
-                    if (! $editline) print $this->showPreview($file,$modulepart,$filepath);
-
 					print "</td>\n";
+					
 					print '<td align="right" width="80px">'.dol_print_size($file['size'],1,1).'</td>';
+					
 					print '<td align="center" width="130px">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>';
 				
 					// Preview
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 67713d7bd2c..66eca2409f3 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1176,7 +1176,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
 	}
 	if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>';      // For thirdparty
 	
-	if ($object->element == 'product' || $object->element == 'bank_account')
+	// Add label
+	if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task')
 	{
 		if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
 	}
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index 0a17a8c07c2..3077e49bf89 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -196,7 +196,9 @@ if ($permission) {
 				$userstatic->id=$tab[$i]['id'];
 				$userstatic->lastname=$tab[$i]['lastname'];
 				$userstatic->firstname=$tab[$i]['firstname'];
-				echo $userstatic->getNomUrl(1);
+				$userstatic->photo=$tab[$i]['photo'];
+				$userstatic->login=$tab[$i]['login'];
+				echo $userstatic->getNomUrl(-1);
 			}
 			if ($tab[$i]['source']=='external')
 			{
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 074f626f299..f44f2f70acf 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -848,7 +848,7 @@ if (! defined('NOREQUIRETRAN'))
 
 // Define some constants used for style of arrays
 $bc=array(0=>'class="impair"',1=>'class="pair"');
-$bcdd=array(0=>'class="drag drop"',1=>'class="drag drop"');
+$bcdd=array(0=>'class="drag drop oddeven"',1=>'class="drag drop oddeven"');
 $bcnd=array(0=>'class="nodrag nodrop nohover"',1=>'class="nodrag nodrop nohoverpair"');		// Used for tr to add new lines
 $bctag=array(0=>'class="tagtr"',1=>'class="pair tagtr"');
 
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 9407fc716c1..791cd6855f0 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -892,13 +892,12 @@ elseif ($object->id > 0)
     
         // Date start - end
         print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
-        print dol_print_date($object->date_start,'day');
-        $end=dol_print_date($object->date_end,'day');
-        if ($end) 
-        {
-            print ' - '.$end;
-            if ($object->hasDelay()) print img_warning($langs->trans('Late'));
-        }
+		$start = dol_print_date($object->date_start,'dayhour');
+		print ($start?$start:'?');
+		$end = dol_print_date($object->date_end,'dayhour');
+		print ' - ';
+		print ($end?$end:'?');
+		if ($object->hasDelay()) print img_warning("Late");
         print '</td></tr>';
     	     
         // Budget
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index 7c986e4d9a2..a5e4cb69492 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -1635,6 +1635,17 @@ class Task extends CommonObject
 			if ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
 			if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');
 		}
+		if ($mode == 6)
+		{
+			/*if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0');
+			if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1');
+			if ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3');
+			if ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4');
+			if ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6');
+			if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5');*/
+		    //return $this->progress.' %';
+		    return '&nbsp;';
+		}
 	}
 
 	/**
diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php
index e9de1f7f787..e843d4951e4 100644
--- a/htdocs/projet/contact.php
+++ b/htdocs/projet/contact.php
@@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref))
 	//print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete;
 
 	$head = project_prepare_head($object);
-	dol_fiche_head($head, 'contact', $langs->trans("Project"), 0, ($object->public?'projectpub':'project'));
+	dol_fiche_head($head, 'contact', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
 
 
     // Project card
@@ -206,9 +206,12 @@ if ($id > 0 || ! empty($ref))
     
     // Date start - end
     print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
-    print dol_print_date($object->date_start,'day');
-    $end=dol_print_date($object->date_end,'day');
-    if ($end) print ' - '.$end;
+	$start = dol_print_date($object->date_start,'dayhour');
+	print ($start?$start:'?');
+	$end = dol_print_date($object->date_end,'dayhour');
+	print ' - ';
+	print ($end?$end:'?');
+	if ($object->hasDelay()) print img_warning("Late");
     print '</td></tr>';
 
     // Budget
@@ -235,7 +238,7 @@ if ($id > 0 || ! empty($ref))
     print '</td></tr>';
     
     // Categories
-    if($conf->categorie->enabled) {
+    if ($conf->categorie->enabled) {
         print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td>';
         print $form->showCategories($object->id,'project',1);
         print "</td></tr>";
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 1efc4465d81..7be3cebd46c 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -183,9 +183,12 @@ if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
 
 // Date start - end
 print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
-print dol_print_date($object->date_start,'day');
-$end=dol_print_date($object->date_end,'day');
-if ($end) print ' - '.$end;
+$start = dol_print_date($object->date_start,'dayhour');
+print ($start?$start:'?');
+$end = dol_print_date($object->date_end,'dayhour');
+print ' - ';
+print ($end?$end:'?');
+if ($object->hasDelay()) print img_warning("Late");
 print '</td></tr>';
 
 // Budget
@@ -770,7 +773,6 @@ foreach ($listofreferent as $key => $value)
 		$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
 		if (is_array($elementarray) && count($elementarray)>0)
 		{
-			$var=true;
 			$total_ht = 0;
 			$total_ttc = 0;
 
@@ -813,7 +815,6 @@ foreach ($listofreferent as $key => $value)
 				if ($breakline && $saved_third_id != $element->thirdparty->id)
 				{
 					print $breakline;
-					$var = true;
 
 					$saved_third_id = $element->thirdparty->id;
 					$breakline = '';
@@ -829,8 +830,7 @@ foreach ($listofreferent as $key => $value)
 					if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false;	// Replacement invoice, do not include into total
 				}
 
-				$var=!$var;
-				print "<tr ".$bc[$var].">";
+				print '<tr class="oddeven">';
 				// Remove link
 				print '<td style="width: 24px">';
 				if ($tablename != 'projet_task' && $tablename != 'stock_mouvement')
@@ -909,7 +909,9 @@ foreach ($listofreferent as $key => $value)
 				else if (in_array($tablename, array('projet_task'))) 
 				{
 				    $tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee);	// $element is a task. $elementuser may be empty
+                    print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$idofelement.'&withproject=1">';
 				    print convertSecondToTime($tmpprojtime['nbseconds'], 'allhourmin');
+                	print '</a>';
 				    $total_time_by_line = $tmpprojtime['nbseconds'];
 				}
 				else print dol_print_date($date,'day');
@@ -935,7 +937,7 @@ foreach ($listofreferent as $key => $value)
                 }
                 else if ($tablename == 'projet_task' && $key == 'project_task_time')	// if $key == 'project_task', we don't want details per user
                 {
-                	print $elementuser->getNomUrl(1);
+                    print $elementuser->getNomUrl(1);
                 }
 				print '</td>';
 
diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php
index f60ada41bb1..4e1b53d3f24 100644
--- a/htdocs/projet/ganttchart.inc.php
+++ b/htdocs/projet/ganttchart.inc.php
@@ -167,8 +167,8 @@ function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_
     $parent = $task["task_parent"];
     // Define percent
     $percent = $task['task_percent_complete']?$task['task_percent_complete']:0;
-    // Link
-    $link=DOL_URL_ROOT.'/projet/tasks/task.php?withproject=1&id='.$task["task_id"];
+    // Link (more information)
+    $link=DOL_URL_ROOT.'/projet/tasks/contact.php?withproject=1&id='.$task["task_id"];
 
     // Name
     $name=$task['task_name'];
diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php
index d96e21cf194..36fbfccca77 100644
--- a/htdocs/projet/ganttview.php
+++ b/htdocs/projet/ganttview.php
@@ -94,7 +94,7 @@ if ($id > 0 || ! empty($ref))
     $tab='gantt';
 
     $head=project_prepare_head($object);
-    dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project'));
+    dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
 
     $param=($mode=='mine'?'&mode=mine':'');
 
@@ -138,9 +138,12 @@ if ($id > 0 || ! empty($ref))
     
     // Date start - end
     print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
-    print dol_print_date($object->date_start,'day');
-    $end=dol_print_date($object->date_end,'day');
-    if ($end) print ' - '.$end;
+	$start = dol_print_date($object->date_start,'dayhour');
+	print ($start?$start:'?');
+	$end = dol_print_date($object->date_end,'dayhour');
+	print ' - ';
+	print ($end?$end:'?');
+	if ($object->hasDelay()) print img_warning("Late");
     print '</td></tr>';
     
     // Budget
@@ -253,7 +256,7 @@ if (count($tasksarray)>0)
 		$tasks[$taskcursor]['task_percent_complete']=$val->progress;
 		//$tasks[$taskcursor]['task_name']=$task->getNomUrl(1);
 		//print dol_print_date($val->date_start).dol_print_date($val->date_end).'<br>'."\n";
-		$tasks[$taskcursor]['task_name']=$val->label;
+		$tasks[$taskcursor]['task_name']=$val->ref.' - '.$val->label;
 		$tasks[$taskcursor]['task_start_date']=$val->date_start;
 		$tasks[$taskcursor]['task_end_date']=$val->date_end;
 		$tasks[$taskcursor]['task_color']='b4d1ea';
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index b742b5a3acb..8b72a6448ec 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -207,7 +207,7 @@ if ($id > 0 || ! empty($ref))
 	$tab=GETPOST('tab')?GETPOST('tab'):'tasks';
 
 	$head=project_prepare_head($object);
-	dol_fiche_head($head, $tab, $langs->trans("Project"),0,($object->public?'projectpub':'project'));
+	dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
 
 	$param=($mode=='mine'?'&mode=mine':'');
 
@@ -268,9 +268,12 @@ if ($id > 0 || ! empty($ref))
 
     // Date start - end
     print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
-    print dol_print_date($object->date_start,'day');
-    $end=dol_print_date($object->date_end,'day');
-    if ($end) print ' - '.$end;
+    $start = dol_print_date($object->date_start,'dayhour');
+    print ($start?$start:'?');
+    $end = dol_print_date($object->date_end,'dayhour');
+    print ' - ';
+    print ($end?$end:'?');
+    if ($object->hasDelay()) print img_warning("Late");
     print '</td></tr>';
     
     // Budget
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index 060155d6507..02b31ea83ff 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -279,35 +279,31 @@ if ($id > 0 || ! empty($ref))
 		//$arrayofuseridoftask=$object->getListContactId('internal');
 
 		$head = task_prepare_head($object);
-		dol_fiche_head($head, 'task_contact', $langs->trans("Task"), 0, 'projecttask');
+		dol_fiche_head($head, 'task_contact', $langs->trans("Task"), -1, 'projecttask');
 
 
-		/*
-		 *   Projet synthese pour rappel
-		 */
-		print '<table class="border" width="100%">';
-
 		$param=(GETPOST('withproject')?'&withproject=1':'');
 		$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
-
-		// Ref
-		print '<tr><td class="titlefield">'.$langs->trans('Ref').'</td><td colspan="3">';
+		
 		if (! GETPOST('withproject') || empty($projectstatic->id))
 		{
 		    $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
 		    $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
 		}
 		else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
-		print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','',$param);
-		print '</td></tr>';
-
-		// Label
-		print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
-
-		// Project
-		if (empty($withproject))
+		
+		$morehtmlref='';
+		dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1);
+		
+		if (empty($withproject)) 
 		{
-    		print '<tr><td>'.$langs->trans("Project").'</td><td>';
+		    print '<div class="fichecenter">';
+		
+		    print '<div class="underbanner clearboth"></div>';
+		    print '<table class="border" width="100%">';
+
+		    // Project
+		    print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td>';
     		print $projectstatic->getNomUrl(1);
     		print '</td></tr>';
 
@@ -317,16 +313,18 @@ if ($id > 0 || ! empty($ref))
     		if ($projectstatic->thirdparty->id > 0) print $projectstatic->thirdparty->getNomUrl(1);
     		else print '&nbsp;';
     		print '</td></tr>';
+		
+    		print "</table>";
+		
+    		print '</div>';
 		}
 
-		print "</table>";
-
+		
 		dol_fiche_end();
 
 		/*
 		 * Lignes de contacts
 		 */
-		print '<br>';
 /*
 		// Contacts lines (modules that overwrite templates must declare this into descriptor)
 		$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
@@ -481,7 +479,9 @@ if ($id > 0 || ! empty($ref))
                     $userstatic->id=$tab[$i]['id'];
                     $userstatic->lastname=$tab[$i]['lastname'];
                     $userstatic->firstname=$tab[$i]['firstname'];
-                    print $userstatic->getNomUrl(1);
+    				$userstatic->photo=$tab[$i]['photo'];
+    				$userstatic->login=$tab[$i]['login'];
+                    print $userstatic->getNomUrl(-1);
                 }
                 if ($tab[$i]['source']=='external')
                 {
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index d985454119d..af7d35ab378 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -218,10 +218,7 @@ if ($object->id > 0)
 	}
 
 	$head = task_prepare_head($object);
-	dol_fiche_head($head, 'task_document', $langs->trans("Task"), 0, 'projecttask');
-
-	$param=(GETPOST('withproject')?'&withproject=1':'');
-	$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
+	dol_fiche_head($head, 'task_document', $langs->trans("Task"), -1, 'projecttask');
 
 	// Files list constructor
 	$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@@ -230,10 +227,27 @@ if ($object->id > 0)
 	{
 		$totalsize+=$file['size'];
 	}
+	
+	$param=(GETPOST('withproject')?'&withproject=1':'');
+	$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
 
+	if (! GETPOST('withproject') || empty($projectstatic->id))
+	{
+	    $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
+	    $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
+	}
+	else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
+	
+	$morehtmlref='';
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
+	
+	print '<div class="fichecenter">';
+	
+	print '<div class="underbanner clearboth"></div>';
 	print '<table class="border" width="100%">';
 
 	// Ref
+	/*
 	print '<tr><td class="titlefield">';
 	print $langs->trans("Ref");
 	print '</td><td colspan="3">';
@@ -249,11 +263,12 @@ if ($object->id > 0)
 
 	// Label
 	print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
-
+    */
+	
 	// Project
 	if (empty($withproject))
 	{
-		print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
+		print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
 		print $projectstatic->getNomUrl(1);
 		print '</td></tr>';
 
@@ -265,11 +280,13 @@ if ($object->id > 0)
 	}
 
 	// Files infos
-	print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
+	print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
 	print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
 
 	print "</table>\n";
 
+	print '</div>';
+	
 	dol_fiche_end();
 
 	print '<br>';
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index f595f43bc2b..ebdd3d0c5a3 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -110,7 +110,7 @@ if ($object->id > 0)
 		// Tabs for project
 		$tab='tasks';
 		$head=project_prepare_head($projectstatic);
-		dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project'));
+		dol_fiche_head($head, $tab, $langs->trans("Project"), 0, ($projectstatic->public?'projectpub':'project'));
 
 		$param=($mode=='mine'?'&mode=mine':'');
 		// Project card
@@ -197,13 +197,27 @@ if ($object->id > 0)
 	}
 
 	$head = task_prepare_head($object);
-	dol_fiche_head($head, 'task_notes', $langs->trans('Task'), 0, 'projecttask');
-
-	print '<table class="border" width="100%">';
+	dol_fiche_head($head, 'task_notes', $langs->trans('Task'), -1, 'projecttask');
 
+	
 	$param=(GETPOST('withproject')?'&withproject=1':'');
 	$linkback=GETPOST('withproject')?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
-
+	
+	if (! GETPOST('withproject') || empty($projectstatic->id))
+	{
+	    $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
+	    $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
+	}
+	else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
+	
+	$morehtmlref='';
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
+	
+	print '<div class="fichecenter">';
+	
+    print '<div class="underbanner clearboth"></div>';
+	print '<table class="border" width="100%">';
+    /*
 	// Ref
 	print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
 	if (empty($withproject) || empty($projectstatic->id))
@@ -217,7 +231,8 @@ if ($object->id > 0)
 
 	// Label
 	print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
-
+    */
+	
 	// Project
 	if (empty($withproject))
 	{
@@ -234,12 +249,12 @@ if ($object->id > 0)
 
 	print "</table>";
 
-	print '<br>';
-
 	$cssclass='titlefield';
     $moreparam=$param;
 	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
 
+	print '</div>';
+	
 	dol_fiche_end();
 }
 
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 2665b0b33b5..3e6d658bcc1 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -221,7 +221,7 @@ if ($id > 0 || ! empty($ref))
 			// Tabs for project
 			$tab='tasks';
 			$head=project_prepare_head($projectstatic);
-			dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project'));
+			dol_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public?'projectpub':'project'));
 
 			$param=($mode=='mine'?'&mode=mine':'');
 
@@ -306,6 +306,8 @@ if ($id > 0 || ! empty($ref))
             print '<div class="clearboth"></div>';
         
 			dol_fiche_end();
+
+			print '<br>';
 		}
 
 		/*
@@ -437,9 +439,22 @@ if ($id > 0 || ! empty($ref))
 				print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$_GET["id"].'&withproject='.$withproject,$langs->trans("DeleteATask"),$langs->trans("ConfirmDeleteATask"),"confirm_delete");
 			}
 
+			if (! GETPOST('withproject') || empty($projectstatic->id))
+			{
+			    $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
+			    $object->next_prev_filter=" fk_projet in (".$projectsListId.")";
+			}
+			else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
+			
+			$morehtmlref='';
+			dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
+			
 			print '<div class="fichecenter">';
+			
+			print '<div class="underbanner clearboth"></div>';			
 			print '<table class="border" width="100%">';
 
+			/*
 			// Ref
 			print '<tr><td class="titlefield">';
 			print $langs->trans("Ref");
@@ -456,11 +471,12 @@ if ($id > 0 || ! empty($ref))
 
 			// Label
 			print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
-
+            */
+			
 			// Project
 			if (empty($withproject))
 			{
-				print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
+				print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
 				print $projectstatic->getNomUrl(1);
 				print '</td></tr>';
 
@@ -471,15 +487,14 @@ if ($id > 0 || ! empty($ref))
 				print '</td></tr>';
 			}
 
-			// Date start
-			print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
-			print dol_print_date($object->date_start,'dayhour');
-			print '</td></tr>';
-
-			// Date end
-			print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
-			print dol_print_date($object->date_end,'dayhour');
-        	if ($object->hasDelay()) print img_warning("Late");
+			// Date start - Date end
+			print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td colspan="3">';
+			$start = dol_print_date($object->date_start,'dayhour');
+    		print ($start?$start:'?');
+			$end = dol_print_date($object->date_end,'dayhour');
+    		print ' - ';
+    		print ($end?$end:'?');
+    		if ($object->hasDelay()) print img_warning("Late");
 			print '</td></tr>';
 
 			// Planned workload
@@ -523,7 +538,8 @@ if ($id > 0 || ! empty($ref))
 			}
 
 			print '</table>';
-            print '</div>';
+            
+			print '</div>';
             
 			dol_fiche_end();
 		}
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 4b2b0b4c21e..73aba634c4d 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -49,6 +49,9 @@ $search_datewithhour='';
 $search_note=GETPOST('search_note','alpha');
 $search_duration=GETPOST('search_duration','int');
 $search_value=GETPOST('search_value','int');
+$search_task_ref=GETPOST('search_task_ref','alpha');
+$search_task_label=GETPOST('search_task_label','alpha');
+$search_user=GETPOST('search_user','int');
 
 // Security check
 $socid=0;
@@ -103,6 +106,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
     $search_value='';
     $search_date_creation='';
     $search_date_update='';
+    $search_task_ref='';
+    $search_task_label='';
+    $search_user=0;
     $toselect='';
     $search_array_options=array();
     $action='';
@@ -299,7 +305,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 			// Tabs for project
 			$tab='tasks';
 			$head=project_prepare_head($projectstatic);
-			dol_fiche_head($head, $tab, $langs->trans("Project"),0,($projectstatic->public?'projectpub':'project'));
+			dol_fiche_head($head, $tab, $langs->trans("Project"), 0, ($projectstatic->public?'projectpub':'project'));
 
 			$param=($mode=='mine'?'&mode=mine':'');
 
@@ -418,43 +424,51 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 	if (empty($projectidforalltimes))
 	{
 		$head=task_prepare_head($object);
-		dol_fiche_head($head, 'task_time', $langs->trans("Task"),0,'projecttask');
+		dol_fiche_head($head, 'task_time', $langs->trans("Task"), -1, 'projecttask');
 
 		if ($action == 'deleteline')
 		{
 			print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.'&lineid='.$_GET["lineid"].($withproject?'&withproject=1':''),$langs->trans("DeleteATimeSpent"),$langs->trans("ConfirmDeleteATimeSpent"),"confirm_delete",'','',1);
 		}
 
-		print '<div class="fichecenter">';
-		print '<table class="border" width="100%">';
-
 		$param=($withproject?'&withproject=1':'');
 		$linkback=$withproject?'<a href="'.DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.'">'.$langs->trans("BackToList").'</a>':'';
 
-		// Ref
-		print '<tr><td class="titlefield">';
-		print $langs->trans("Ref");
-		print '</td><td colspan="3">';
 		if (! GETPOST('withproject') || empty($projectstatic->id))
 		{
 			$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1);
 			$object->next_prev_filter=" fk_projet in (".$projectsListId.")";
 		}
 		else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
+		
+		$morehtmlref='';
+		dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
+		
+		print '<div class="fichecenter">';
+		
+        print '<div class="underbanner clearboth"></div>';
+		print '<table class="border" width="100%">';
+
+		// Ref
+		/*
+		print '<tr><td class="titlefield">';
+		print $langs->trans("Ref");
+		print '</td><td colspan="3">';
 		print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','',$param);
 		print '</td></tr>';
 
 		// Label
 		print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
-
-		// Date start
-		print '<tr><td>'.$langs->trans("DateStart").'</td><td colspan="3">';
-		print dol_print_date($object->date_start,'dayhour');
-		print '</td></tr>';
-
-		// Date end
-		print '<tr><td>'.$langs->trans("DateEnd").'</td><td colspan="3">';
-		print dol_print_date($object->date_end,'dayhour');
+        */
+		
+		// Date start - Date end
+		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td colspan="3">';
+		$start = dol_print_date($object->date_start,'dayhour');
+		print ($start?$start:'?');
+		$end = dol_print_date($object->date_end,'dayhour');
+		print ' - ';
+		print ($end?$end:'?');
+		if ($object->hasDelay()) print img_warning("Late");
 		print '</td></tr>';
 
 		// Planned workload
@@ -517,11 +531,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 			print '<td>'.$langs->trans("Date").'</td>';
 			print '<td>'.$langs->trans("By").'</td>';
 			print '<td>'.$langs->trans("Note").'</td>';
+			print '<td>'.$langs->trans("NewTimeSpent").'</td>';
 			print '<td>'.$langs->trans("ProgressDeclared").'</td>';
-			print '<td align="right" colspan="2">'.$langs->trans("NewTimeSpent").'</td>';
+			print '<td></td>';
 			print "</tr>\n";
 
-			print '<tr '.$bc[false].'>';
+			print '<tr class="oddeven">';
 
 			// Date
 			print '<td class="maxwidthonsmartphone">';
@@ -550,16 +565,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 			print '<textarea name="timespent_note" class="maxwidth100onsmartphone" rows="'.ROWS_2.'">'.($_POST['timespent_note']?$_POST['timespent_note']:'').'</textarea>';
 			print '</td>';
 
+			// Duration - Time spent
+			print '<td>';
+			print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text');
+			print '</td>';
+
 			// Progress declared
 			print '<td class="nowrap">';
 			print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress');
 			print '</td>';
 
-			// Duration - Time spent
-			print '<td class="nowrap" align="right">';
-			print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text');
-			print '</td>';
-
 			print '<td align="center">';
 			print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
 			print '</td></tr>';
@@ -609,13 +624,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 		
 		$sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm,";
 		$sql .= " pt.ref, pt.label,";
-		$sql .= " u.lastname, u.firstname";
+		$sql .= " u.lastname, u.firstname, u.login, u.photo";
 		$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u";
 		$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
 		if (empty($projectidforalltimes)) $sql .= " AND t.fk_task =".$object->id;
 		else $sql.= " AND pt.fk_projet IN (".$projectidforalltimes.")";
 		if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
 		if ($search_note) $sql .= natural_search('t.note', $search_note);
+		if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref);
+		if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label);
+		if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user);
 		$sql .= $db->order($sortfield, $sortorder);
         
 		$var=true;
@@ -711,50 +729,23 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
         print '<div class="div-table-responsive">';
 		print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
 		
-		print '<tr class="liste_titre">';
-		if (! empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'],$_SERVER['PHP_SELF'],'t.task_date,t.task_datehour,t.rowid','',$params,'',$sortfield,$sortorder);
-		if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes))   // Not a dedicated task
-        {
-            if (! empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'],$_SERVER['PHP_SELF'],'pt.ref','',$params,'',$sortfield,$sortorder);            
-            if (! empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'],$_SERVER['PHP_SELF'],'pt.label','',$params,'',$sortfield,$sortorder);            
-        }
-        if (! empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'],$_SERVER['PHP_SELF'],'','',$params,'',$sortfield,$sortorder);
-		if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'],$_SERVER['PHP_SELF'],'t.note','',$params,'',$sortfield,$sortorder);
-		if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'],$_SERVER['PHP_SELF'],'t.task_duration','',$params,'align="right"',$sortfield,$sortorder);
-		if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'],$_SERVER['PHP_SELF'],'','',$params,'align="right"',$sortfield,$sortorder);
-		// Extra fields
-		/*
-    	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
-    	{
-    	   foreach($extrafields->attribute_label as $key => $val) 
-    	   {
-               if (! empty($arrayfields["ef.".$key]['checked'])) 
-               {
-    				$align=$extrafields->getAlignFlag($key);
-    				print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
-               }
-    	   }
-    	}*/
-	    // Hook fields
-    	$parameters=array('arrayfields'=>$arrayfields);
-        $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters);    // Note that $action and $object may have been modified by hook
-        print $hookmanager->resPrint;
-    	print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
-		print "</tr>\n";
-
 		// Fields title search
-		print '<tr class="liste_titre">';
-		// LIST_OF_TD_TITLE_SEARCH
+		print '<tr class="liste_titre_filter">';
+		// Date
 		if (! empty($arrayfields['t.task_date']['checked'])) print '<td class="liste_titre"></td>';
 		if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes))   // Not a dedicated task
         {
-            if (! empty($arrayfields['t.task_ref']['checked'])) print '<td class="liste_titre"></td>';
-            if (! empty($arrayfields['t.task_label']['checked'])) print '<td class="liste_titre"></td>';
+            if (! empty($arrayfields['t.task_ref']['checked'])) print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_task_ref" value="'.dol_escape_htmltag($search_task_ref).'"></td>';
+            if (! empty($arrayfields['t.task_label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_task_label" value="'.dol_escape_htmltag($search_task_label).'"></td>';
         }
-        if (! empty($arrayfields['author']['checked'])) print '<td class="liste_titre"></td>';
-		if (! empty($arrayfields['t.note']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" name="search_note" value="'.$search_note.'"></td>';
-		if (! empty($arrayfields['t.task_duration']['checked'])) print '<td class="liste_titre right"></td>';
-		if (! empty($arrayfields['value']['checked'])) print '<td class="liste_titre"></td>';
+        // Author
+        if (! empty($arrayfields['author']['checked'])) print '<td class="liste_titre">'.$form->select_dolusers($search_user > 0 ? $search_user : -1, 'search_user', 1).'</td>';
+		// Note
+        if (! empty($arrayfields['t.note']['checked'])) print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_note" value="'.dol_escape_htmltag($search_note).'"></td>';
+		// Duration
+        if (! empty($arrayfields['t.task_duration']['checked'])) print '<td class="liste_titre right"></td>';
+		// Value in currency
+        if (! empty($arrayfields['value']['checked'])) print '<td class="liste_titre"></td>';
 		// Extra fields
 		/*
 		if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@@ -784,11 +775,42 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 		$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters);    // Note that $action and $object may have been modified by hook
 		print $hookmanager->resPrint;
 		// Action column
-		print '<td class="liste_titre" align="right">';
+		print '<td class="liste_titre center">';
 		$searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
 		print $searchpitco;
 		print '</td>';
-		print '</tr>'."\n";		
+		print '</tr>'."\n";	
+		
+		print '<tr class="liste_titre">';
+		if (! empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'],$_SERVER['PHP_SELF'],'t.task_date,t.task_datehour,t.rowid','',$params,'',$sortfield,$sortorder);
+		if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes))   // Not a dedicated task
+        {
+            if (! empty($arrayfields['t.task_ref']['checked']))   print_liste_field_titre($arrayfields['t.task_ref']['label'],$_SERVER['PHP_SELF'],'pt.ref','',$params,'',$sortfield,$sortorder);            
+            if (! empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'],$_SERVER['PHP_SELF'],'pt.label','',$params,'',$sortfield,$sortorder);            
+        }
+        if (! empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'],$_SERVER['PHP_SELF'],'','',$params,'',$sortfield,$sortorder);
+		if (! empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'],$_SERVER['PHP_SELF'],'t.note','',$params,'',$sortfield,$sortorder);
+		if (! empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'],$_SERVER['PHP_SELF'],'t.task_duration','',$params,'align="right"',$sortfield,$sortorder);
+		if (! empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'],$_SERVER['PHP_SELF'],'','',$params,'align="right"',$sortfield,$sortorder);
+		// Extra fields
+		/*
+    	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
+    	{
+    	   foreach($extrafields->attribute_label as $key => $val) 
+    	   {
+               if (! empty($arrayfields["ef.".$key]['checked'])) 
+               {
+    				$align=$extrafields->getAlignFlag($key);
+    				print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
+               }
+    	   }
+    	}*/
+	    // Hook fields
+    	$parameters=array('arrayfields'=>$arrayfields);
+        $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters);    // Note that $action and $object may have been modified by hook
+        print $hookmanager->resPrint;
+    	print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center" width="80"',$sortfield,$sortorder,'maxwidthsearch ');
+		print "</tr>\n";
 
 		$tasktmp = new Task($db);
 		
@@ -802,7 +824,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 		foreach ($tasks as $task_time)
 		{
 			$var=!$var;
-			print "<tr ".$bc[$var].">";
+			print '<tr class="oddeven">';
 
 			$date1=$db->jdate($task_time->task_date);
 			$date2=$db->jdate($task_time->task_datehour);
@@ -873,7 +895,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
     				$userstatic->id         = $task_time->fk_user;
     				$userstatic->lastname	= $task_time->lastname;
     				$userstatic->firstname 	= $task_time->firstname;
-    				print $userstatic->getNomUrl(1);
+    				$userstatic->photo      = $task_time->photo;
+    				print $userstatic->getNomUrl(-1);
     			}
     			print '</td>';
     			if (! $i) $totalarray['nbfield']++;
@@ -932,7 +955,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 			print $hookmanager->resPrint;
 		
             // Action column
-			print '<td class="right" valign="middle" width="80">';
+			print '<td class="center"">';
 			if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid)
 			{
 				print '<input type="hidden" name="lineid" value="'.$_GET['lineid'].'">';
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 112609ce521..8529a0c0cfc 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -1987,7 +1987,7 @@ class User extends CommonObject
 		if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0;
 
         $result=''; $label='';
-        $linkstart=''; $linkend='';
+        $link=''; $linkstart=''; $linkend='';
 		
 		if (! empty($this->photo))
 		{
@@ -2086,7 +2086,9 @@ class User extends CommonObject
 		}
 		$result.=$linkend;
 		//if ($withpictoimg == -1) $result.='</div>';
+		
 		$result.=$companylink;
+		
 		return $result;
 	}
 
-- 
GitLab