diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index a805bbfaad2..1e5046d4d58 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -867,7 +867,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec * @param string $projectsrole Array of roles user has on project * @param string $tasksrole Array of roles user has on task * @param string $mine Show only task lines I am assigned to - * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to + * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others * @param int $preselectedday Preselected day * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon * @param int $oldprojectforbreak Old project id of last project break @@ -911,6 +911,11 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr { //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); + if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases + { + continue; + } + // Break on a new project if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { @@ -1152,7 +1157,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr * @param string $projectsrole Array of roles user has on project * @param string $tasksrole Array of roles user has on task * @param string $mine Show only task lines I am assigned to - * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to + * @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is assigned to me, 2=Enable add time only if tasks is assigned to me and hide others * @param array $isavailable Array with data that say if user is available for several days for morning and afternoon * @param int $oldprojectforbreak Old project id of last project break * @return array Array with time spent for $fuser for each day of week on tasks in $lines and substasks @@ -1196,6 +1201,11 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ { //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); + if ($restricteditformytask == 2 && empty($tasksrole[$lines[$i]->id])) // we have no role on task and we request to hide such cases + { + continue; + } + // Break on a new project if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index c3351a5efff..623838f8149 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -118,6 +118,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_project_ref = ''; $search_thirdparty = ''; $search_declared_progress = ''; + + // We redefine $usertoprocess + $usertoprocess=$user; } if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha')) { @@ -345,7 +348,7 @@ if ($morewherefilter) // Get all task without any filter, so we can show total o } $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); -//var_dump($tasksarray); +//var_dump($usertoprocess); //var_dump($projectsrole); //var_dump($taskrole); @@ -502,7 +505,7 @@ print '