diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 48167edcc1d..e69f4fcd899 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -317,7 +317,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $object->project = clone $projectstatic; } - $userWrite = $projectstatic->restrictedProjectArea($user,'write'); + $userRead = $projectstatic->restrictedProjectArea($user, 'read'); + $linktocreatetime = ''; if ($projectstatic->id > 0) { @@ -427,33 +428,30 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) print '
'; // Link to create time - //if ((empty($id) && empty($ref)) || ! empty($projectidforalltimes)) - //{ - if ($user->rights->projet->all->creer || $user->rights->projet->creer) - { - if ($projectstatic->public || $userWrite > 0) - { - if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - } - else - { - $linktocreatetime = ''.$langs->trans('AddTime').''; - } - //} + if ($user->rights->projet->all->lire || $user->rights->projet->lire)) // To enter time, read permission is enough + { + if ($projectstatic->public || $userRead > 0) + { + if (! empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject?'&withproject=1':''); + $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } + } + else + { + $linktocreatetime = ''.$langs->trans('AddTime').''; + } } } @@ -803,7 +801,12 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Duration - Time spent print ''; - print $form->select_duration('timespent_duration', ($_POST['timespent_duration']?$_POST['timespent_duration']:''), 0, 'text'); + $durationtouse = ($_POST['timespent_duration']?$_POST['timespent_duration']:''); + if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) + { + $durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60); + } + print $form->select_duration('timespent_duration', $durationtouse, 0, 'text'); print ''; // Progress declared