From 1e473839e7bfd8a845a829f7fc338afde422f4fe Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <ldestailleur@teclib.com>
Date: Thu, 7 Aug 2014 12:05:42 +0200
Subject: [PATCH] Fix: visible task into area "time" for "My task" must limit
 task to tasks i am assigned to.

---
 htdocs/projet/tasks/time.php | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 2ef635dbe53..cb8a4dd193a 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -65,7 +65,8 @@ if ($action == 'addtimespent' && $user->rights->projet->creer)
 	}
 	if (empty($_POST["userid"]))
 	{
-		setEventMessage($langs->trans('ErrorUserNotAffectedToTask'),'errors');
+		$langs->load("errors");
+		setEventMessage($langs->trans('ErrorUserNotAssignedToTask'),'errors');
 		$error++;
 	}
 
@@ -337,9 +338,13 @@ if ($id > 0 || ! empty($ref))
 
 			// Contributor
 			print '<td class="nowrap">';
-			$contactoftask=$object->getListContactId('internal');
+			$restrictaddtimetocontactoftask=0;
+			if (empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS))
+			{
+				$restrictaddtimetocontactoftask=$object->getListContactId('internal');
+			}
 			print img_object('','user');
-			print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$contactoftask);
+			print $form->select_dolusers($_POST["userid"]?$_POST["userid"]:$user->id,'userid',0,'',0,'',$restrictaddtimetocontactoftask);	// Note: If user is not allowed it will be disabled into combo list and userid not posted
 			print '</td>';
 
 			// Note
-- 
GitLab