From d0c3a7913f9c0d42acc2dfa1541babecc9e6d41e 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.

---
 ChangeLog                    |  4 +++-
 htdocs/projet/tasks/time.php | 11 ++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f716768589a..2da9d45364d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,7 +15,9 @@ Fix: [ bug #1528 ] Leopard Services numeration module description is not transla
 Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas
 Fix: [ bug #1534 ] Unknown error when deleting a product photo under special circumstances
 Fix: Update impayees.php
-Fix: Fix Link product, In list view and label product
+Fix: Link product, In list view and label product
+Fix: visible task into area "time" for "My task" must limit task to tasks i am assigned to.
+Fix: When disabled, all fields to add time into task line must be disabled.
 
 ***** ChangeLog for 3.5.4 compared to 3.5.3 *****
 Fix: Hide title of event when agenda module disabled.
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index b9ebc7ae5de..36a8e26cf38 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++;
 	}
 
@@ -327,9 +328,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