diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 3844d8eeb50..905b8bbf4f1 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -71,7 +71,7 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortfield) $sortfield='t.task_date,t.task_datehour,t.rowid'; -if (! $sortorder) $sortorder='DESC'; +if (! $sortorder) $sortorder='DESC,DESC,DESC'; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context //$object = new TaskTime($db); @@ -158,7 +158,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) else { $object->timespent_note = $_POST["timespent_note"]; - $object->progress = GETPOST('progress', 'int'); + if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value $object->timespent_duration = $_POST["timespent_durationhour"]*60*60; // We store duration in seconds $object->timespent_duration+= $_POST["timespent_durationmin"]*60; // We store duration in seconds if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered @@ -422,7 +422,16 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) { if ($projectstatic->public || $userWrite > 0) { - $linktocreatetime = ''.$langs->trans('AddTimeSpent').''; + 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 { @@ -600,7 +609,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Progress declared print ''; - print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress'); + print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); print ''; print ''; @@ -785,7 +794,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) // Progress declared print ''; - print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress,'progress'); + print $formother->select_percent(GETPOST('progress')?GETPOST('progress'):$object->progress, 'progress', 0, 5, 0, 100, 1); print ''; print '';