From a36a9fab2fbaa9e91c884d82fdba7ca85b486f1c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Thu, 18 May 2017 12:12:36 +0200
Subject: [PATCH] Look and feel v6

---
 htdocs/core/lib/project.lib.php    |  2 +-
 htdocs/projet/card.php             |  2 +-
 htdocs/projet/class/task.class.php |  2 +-
 htdocs/projet/element.php          |  3 +-
 htdocs/projet/tasks.php            | 11 +++--
 htdocs/projet/tasks/contact.php    | 34 ++++++---------
 htdocs/projet/tasks/document.php   | 48 +++++++--------------
 htdocs/projet/tasks/note.php       | 47 +++++++--------------
 htdocs/projet/tasks/task.php       | 48 +++++++--------------
 htdocs/projet/tasks/time.php       | 67 ++++++++++++++++--------------
 10 files changed, 104 insertions(+), 160 deletions(-)

diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index 96bcbaa00c4..38f78dd8333 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -479,7 +479,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
 				if ($lines[$i]->planned_workload || $lines[$i]->duration)
 				{
 					if ($lines[$i]->planned_workload) print round(100 * $lines[$i]->duration / $lines[$i]->planned_workload,2).' %';
-					else print $langs->trans('WorkloadNotDefined');
+					else print '<span class="opacitymedium">'.$langs->trans('WorkloadNotDefined').'</span>';
 				}
 				print '</td>';
 
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index 1ee81f7b917..47d0f1c3148 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -711,7 +711,7 @@ elseif ($object->id > 0)
     print '<input type="hidden" name="comefromclone" value="'.$comefromclone.'">';
 
     $head=project_prepare_head($object);
-    dol_fiche_head($head, 'project', $langs->trans("Project"),0,($object->public?'projectpub':'project'));
+    dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
 
     if ($action == 'edit' && $userWrite > 0)
     {
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index dad46c96989..e1025241115 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -127,7 +127,7 @@ class Task extends CommonObject
         $sql.= ", ".$user->id;
         $sql.= ", ".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null');
         $sql.= ", ".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null');
-        $sql.= ", ".($this->planned_workload!=''?$this->planned_workload:0);
+        $sql.= ", ".(($this->planned_workload!='' && $this->planned_workload >= 0)?$this->planned_workload:'null');
         $sql.= ", ".(($this->progress!='' && $this->progress >= 0)?$this->progress:'null');
         $sql.= ")";
 
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 02bf6c5a9ba..8aebe756d70 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -123,7 +123,7 @@ $userstatic=new User($db);
 $userAccess = $object->restrictedProjectArea($user);
 
 $head=project_prepare_head($object);
-dol_fiche_head($head, 'element', $langs->trans("Project"),0,($object->public?'projectpub':'project'));
+dol_fiche_head($head, 'element', $langs->trans("Project"), -1, ($object->public?'projectpub':'project'));
 
 
 // Project card
@@ -231,6 +231,7 @@ print '<div class="clearboth"></div>';
 
 dol_fiche_end();
 
+print '<br>';
 
 /*
  * Referers types
diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php
index 06bd2c9c730..fdeebd0ca69 100644
--- a/htdocs/projet/tasks.php
+++ b/htdocs/projet/tasks.php
@@ -92,9 +92,12 @@ if ($action == 'createtask' && $user->rights->projet->creer)
 {
 	$error=0;
 
-	$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
-	$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
-
+    // If we use user timezone, we must change also view/list to use user timezone everywhere
+    //$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user');
+	//$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user');
+	$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']);
+	$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']);
+	
 	if (! $cancel)
 	{
 		if (empty($taskref))
@@ -215,7 +218,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='';
     if ($search_user_id > 0) $param.='&search_user_id='.dol_escape_htmltag($search_user_id);
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index e2f94406558..9160f2b3795 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -293,33 +293,23 @@ if ($id > 0 || ! empty($ref))
 		else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
 		
 		$morehtmlref='';
-		dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1);
 		
-		if (empty($withproject)) 
+		// Project
+		if (empty($withproject))
 		{
-		    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>';
-
-    		// Customer
-    		print "<tr><td>".$langs->trans("ThirdParty")."</td>";
-    		print '<td colspan="3">';
-    		if ($projectstatic->thirdparty->id > 0) print $projectstatic->thirdparty->getNomUrl(1);
-    		else print '&nbsp;';
-    		print '</td></tr>';
-		
-    		print "</table>";
+		    $morehtmlref.='<div class="refidno">';
+		    $morehtmlref.=$langs->trans("Project").': ';
+		    $morehtmlref.=$projectstatic->getNomUrl(1);
+		    $morehtmlref.='<br>';
 		
-    		print '</div>';
+		    // Third party
+		    $morehtmlref.=$langs->trans("ThirdParty").': ';
+		    $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
+		    $morehtmlref.='</div>';
 		}
-
 		
+		dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1);
+
 		dol_fiche_end();
 
 		/*
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 684b7648ab8..241ba0162e5 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -239,6 +239,21 @@ if ($object->id > 0)
 	else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
 	
 	$morehtmlref='';
+	
+	// Project
+	if (empty($withproject))
+	{
+	    $morehtmlref.='<div class="refidno">';
+	    $morehtmlref.=$langs->trans("Project").': ';
+	    $morehtmlref.=$projectstatic->getNomUrl(1);
+	    $morehtmlref.='<br>';
+	
+	    // Third party
+	    $morehtmlref.=$langs->trans("ThirdParty").': ';
+	    $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
+	    $morehtmlref.='</div>';
+	}
+	
 	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
 	
 	print '<div class="fichecenter">';
@@ -246,39 +261,6 @@ if ($object->id > 0)
 	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">';
-	if (empty($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>';
-	print '</tr>';
-
-	// Label
-	print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
-    */
-	
-	// Project
-	if (empty($withproject))
-	{
-		print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
-		print $projectstatic->getNomUrl(1);
-		print '</td></tr>';
-
-		// Third party
-		print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
-		if ($projectstatic->thirdparty->id) print $projectstatic->thirdparty->getNomUrl(1);
-		else print '&nbsp;';
-		print '</td></tr>';
-	}
-
 	// Files infos
 	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>';
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index ebdd3d0c5a3..0d6df7d85fd 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -211,43 +211,26 @@ if ($object->id > 0)
 	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))
-	{
-	    $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))
 	{
-		print '<tr><td>'.$langs->trans("Project").'</td><td colspan="3">';
-		print $projectstatic->getNomUrl(1);
-		print '</td></tr>';
-
-		// Third party
-		print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
-		if ($projectstatic->thirdparty->id > 0) print $projectstatic->thirdparty->getNomUrl(1);
-		else print'&nbsp;';
-		print '</td></tr>';
+	    $morehtmlref.='<div class="refidno">';
+	    $morehtmlref.=$langs->trans("Project").': ';
+	    $morehtmlref.=$projectstatic->getNomUrl(1);
+	    $morehtmlref.='<br>';
+	
+	    // Third party
+	    $morehtmlref.=$langs->trans("ThirdParty").': ';
+	    $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
+	    $morehtmlref.='</div>';
 	}
-
-	print "</table>";
+	
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
+	
+	print '<div class="fichecenter">';
+	
+    print '<div class="underbanner clearboth"></div>';
 
 	$cssclass='titlefield';
     $moreparam=$param;
diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php
index 603a69a07b0..5f493167fd8 100644
--- a/htdocs/projet/tasks/task.php
+++ b/htdocs/projet/tasks/task.php
@@ -447,6 +447,21 @@ if ($id > 0 || ! empty($ref))
 			else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
 			
 			$morehtmlref='';
+			
+			// Project
+			if (empty($withproject))
+			{
+			    $morehtmlref.='<div class="refidno">';
+			    $morehtmlref.=$langs->trans("Project").': ';
+			    $morehtmlref.=$projectstatic->getNomUrl(1);
+			    $morehtmlref.='<br>';
+			
+			    // Third party
+			    $morehtmlref.=$langs->trans("ThirdParty").': ';
+			    $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
+			    $morehtmlref.='</div>';
+			}
+			
 			dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
 			
 			print '<div class="fichecenter">';
@@ -454,39 +469,6 @@ if ($id > 0 || ! empty($ref))
 			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">';
-			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>';
-			print '</tr>';
-
-			// Label
-			print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
-            */
-			
-			// Project
-			if (empty($withproject))
-			{
-				print '<tr><td class="titlefield">'.$langs->trans("Project").'</td><td colspan="3">';
-				print $projectstatic->getNomUrl(1);
-				print '</td></tr>';
-
-				// Third party
-				print '<td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
-				if ($projectstatic->societe->id) print $projectstatic->societe->getNomUrl(1);
-				else print '&nbsp;';
-				print '</td></tr>';
-			}
-
 			// 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');
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index eed7bae2734..0cbe660dd9e 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -1,6 +1,6 @@
 <?php
 /* Copyright (C) 2005		Rodolphe Quiedeville	<rodolphe@quiedeville.org>
- * Copyright (C) 2006-2016	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2006-2017	Laurent Destailleur		<eldy@users.sourceforge.net>
  * Copyright (C) 2010-2012	Regis Houssin			<regis.houssin@capnetworks.com>
  * Copyright (C) 2011		Juanjo Menent			<jmenent@2byte.es>
  *
@@ -442,27 +442,31 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 		else $object->next_prev_filter=" fk_projet = ".$projectstatic->id;
 		
 		$morehtmlref='';
+		
+		// Project
+		if (empty($withproject))
+		{
+		    $morehtmlref.='<div class="refidno">';
+		    $morehtmlref.=$langs->trans("Project").': ';
+		    $morehtmlref.=$projectstatic->getNomUrl(1);
+		    $morehtmlref.='<br>';
+		
+		    // Third party
+		    $morehtmlref.=$langs->trans("ThirdParty").': ';
+		    $morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
+		    $morehtmlref.='</div>';
+		}
+		
 		dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param);
 		
 		print '<div class="fichecenter">';
+		print '<div class="fichehalfleft">';
 		
         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 - Date end
-		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td colspan="3">';
+		print '<tr><td class="titlefield">'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
 		$start = dol_print_date($object->date_start,'dayhour');
 		print ($start?$start:'?');
 		$end = dol_print_date($object->date_end,'dayhour');
@@ -472,17 +476,25 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 		print '</td></tr>';
 
 		// Planned workload
-		print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td colspan="3">';
+		print '<tr><td>'.$langs->trans("PlannedWorkload").'</td><td>';
 		print convertSecondToTime($object->planned_workload,'allhourmin');
 		print '</td></tr>';
 
+		print '</table>';
+		print '</div>';
+		
+		print '<div class="fichehalfright"><div class="ficheaddleft">';
+		
+		print '<div class="underbanner clearboth"></div>';
+		print '<table class="border" width="100%">';
+		
 		// Progress declared
-		print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td colspan="3">';
+		print '<tr><td>'.$langs->trans("ProgressDeclared").'</td><td>';
 		print $object->progress.' %';
 		print '</td></tr>';
 
 		// Progress calculated
-		print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td colspan="3">';
+		print '<tr><td>'.$langs->trans("ProgressCalculated").'</td><td>';
 		if ($object->planned_workload)
 		{
 			$tmparray=$object->getSummaryOfTimeSpent();
@@ -492,23 +504,14 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
 		else print '';
 		print '</td></tr>';
 
-		// Project
-		if (empty($withproject))
-		{
-			print '<tr><td>'.$langs->trans("Project").'</td><td>';
-			print $projectstatic->getNomUrl(1);
-			print '</td></tr>';
-
-			// Third party
-			print '<td>'.$langs->trans("ThirdParty").'</td><td>';
-			if ($projectstatic->thirdparty->id) print $projectstatic->thirdparty->getNomUrl(1);
-			else print '&nbsp;';
-			print '</td></tr>';
-		}
-
 		print '</table>';
-        print '</div>';
+
+		print '</div>';
+		print '</div>';
         
+		print '</div>';
+		print '<div class="clearboth"></div>';
+		    
 		dol_fiche_end();
 
 
-- 
GitLab