Fix: visible task into area "time" for "My task" must limit task to
tasks i am assigned to. Conflicts: htdocs/core/lib/project.lib.php htdocs/projet/activity/list.php
This commit is contained in:
parent
a49bce10de
commit
48fc945648
@ -428,10 +428,11 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
* @param int &$level ?
|
||||
* @param string &$projectsrole ?
|
||||
* @param string &$tasksrole ?
|
||||
* @param int $mytask 0 or 1 to enable only if task is a task i am affected to
|
||||
* @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
|
||||
* @return $inc
|
||||
*/
|
||||
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mytask=0)
|
||||
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
|
||||
{
|
||||
global $user, $bc, $langs;
|
||||
global $form, $projectstatic, $taskstatic;
|
||||
@ -454,6 +455,9 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
}
|
||||
|
||||
// If we want all or we have a role on task, we show it
|
||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
// Project
|
||||
@ -485,12 +489,12 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
|
||||
// Date start
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_start,'day');
|
||||
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Date end
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_end,'day');
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Planned Workload
|
||||
@ -525,8 +529,8 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
$disabledproject=0;
|
||||
$disabledtask=0;
|
||||
}
|
||||
// If mytask and no role on task
|
||||
if ($mytask && empty($tasksrole[$lines[$i]->id]))
|
||||
// If $restricteditformytask is on and I have no role on task, i disable edit
|
||||
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
$disabledtask=1;
|
||||
}
|
||||
@ -544,9 +548,11 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$inc++;
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mytask);
|
||||
if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
$level--;
|
||||
}
|
||||
else
|
||||
|
||||
@ -158,9 +158,12 @@ print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print '<td colspan="2">'.$langs->trans("AddDuration").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// By default, we can edit only tasks we are assigned to
|
||||
$restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJECTS)?1:0);
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine);
|
||||
projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user