Merge branch '8.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-09-16 14:24:13 +02:00
commit eeb919dcda
3 changed files with 21 additions and 6 deletions

View File

@ -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)
{

View File

@ -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 '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").($user
print '<td class="center leftborder">'.$langs->trans("HourStart").'</td>';
// By default, we can edit only tasks we are assigned to
$restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0);
$restrictviewformytask=((! isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
// Get if user is available or not for each day
$isavailable=array();

View File

@ -129,6 +129,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'))
{
@ -594,8 +597,7 @@ if ($conf->use_javascript_ajax)
// By default, we can edit only tasks we are assigned to
$restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0);
$restrictviewformytask=((! isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED);
if (count($tasksarray) > 0)
{
//var_dump($tasksarray); // contains only selected tasks