From 08145dd2ddef559761d7389d8bedab1dcb0ec133 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Sat, 24 Apr 2010 17:23:35 +0000
Subject: [PATCH] Fix: Contacts in task list must be limited to contact linked
 to project

---
 htdocs/lib/project.lib.php      | 23 ++++++++++++-----------
 htdocs/projet/tasks/contact.php |  2 +-
 htdocs/projet/tasks/note.php    | 10 +++++-----
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/htdocs/lib/project.lib.php b/htdocs/lib/project.lib.php
index 49d6554306f..68d61401ad4 100644
--- a/htdocs/lib/project.lib.php
+++ b/htdocs/lib/project.lib.php
@@ -35,16 +35,6 @@ function project_prepare_head($object)
     $head[$h][2] = 'project';
 	$h++;
 
-	$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$object->id;
-	$head[$h][1] = $langs->trans("Tasks");
-    $head[$h][2] = 'tasks';
-	$h++;
-
-	$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$object->id.'&mode=mine';
-	$head[$h][1] = $langs->trans("MyTasks");
-    $head[$h][2] = 'mytasks';
-	$h++;
-
 	if ($conf->propal->enabled || $conf->commande->enabled || $conf->facture->enabled)
 	{
 		$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id;
@@ -89,7 +79,18 @@ function project_prepare_head($object)
         }
     }
 
-	return $head;
+    // Then tab for sub level of projet, i mean tasks
+	$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$object->id;
+	$head[$h][1] = $langs->trans("Tasks");
+    $head[$h][2] = 'tasks';
+	$h++;
+
+	$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/fiche.php?id='.$object->id.'&mode=mine';
+	$head[$h][1] = $langs->trans("MyTasks");
+    $head[$h][2] = 'mytasks';
+	$h++;
+
+    return $head;
 }
 
 
diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php
index aa40c3bc601..9f57d881e3b 100644
--- a/htdocs/projet/tasks/contact.php
+++ b/htdocs/projet/tasks/contact.php
@@ -286,7 +286,7 @@ if ($id > 0 || ! empty($ref))
 
 				print '<td colspan="1">';
 				$thirdpartyofproject=$project->getListContactId('thirdparty');
-				$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$projectstatic->societe->id;
+				$selectedCompany = isset($_GET["newcompany"])?$_GET["newcompany"]:$project->societe->id;
 				$selectedCompany = $formcompany->selectCompaniesForNewContact($task, 'id', $selectedCompany, 'newcompany',$thirdpartyofproject);
 				print '</td>';
 
diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php
index ec31ee9bd92..53503ca1eff 100644
--- a/htdocs/projet/tasks/note.php
+++ b/htdocs/projet/tasks/note.php
@@ -19,7 +19,7 @@
 /**
  *	\file       htdocs/projet/tasks/note.php
  *	\ingroup    project
- *	\brief      Fiche d'information sur une tache
+ *	\brief      Page to show information on a task
  *	\version    $Id$
  */
 
@@ -137,7 +137,7 @@ if ($id > 0 || ! empty($ref))
 		print '</td></tr>';
 
 		// Note publique
-		print '<tr><td valign="top">'.$langs->trans("NotePublic").' :</td>';
+		print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
 		print '<td valign="top" colspan="3">';
 		if ($_GET["action"] == 'edit')
 		{
@@ -157,7 +157,7 @@ if ($id > 0 || ! empty($ref))
 		// Note privee
 		if (! $user->societe_id)
 		{
-			print '<tr><td valign="top">'.$langs->trans("NotePrivate").' :</td>';
+			print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
 			print '<td valign="top" colspan="3">';
 			if ($_GET["action"] == 'edit')
 			{
@@ -183,7 +183,7 @@ if ($id > 0 || ! empty($ref))
 		 * Actions
 		 */
 		print '<div class="tabsAction">';
-		
+
 		if ((($user->rights->projet->creer && $userAccess) || $user->rights->projet->all->creer) && $_GET['action'] <> 'edit')
 		{
 			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>';
@@ -192,7 +192,7 @@ if ($id > 0 || ! empty($ref))
 		{
 			print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a>';
 		}
-		
+
 		print '</div>';
 	}
 }
-- 
GitLab