diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e9ceb297680..d8ecc52f6d9 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -445,7 +445,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t * * @param string $inc ? * @param string $parent ? - * @param Object $lines ? + * @param Task[] $lines ? * @param int $level ? * @param string $projectsrole ? * @param string $tasksrole ? @@ -455,9 +455,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t */ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0) { - global $user, $bc, $langs; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + + global $db, $user, $bc, $langs; global $form, $projectstatic, $taskstatic; + $formother = new FormOther($db); + $lastprojectid=0; $var=true; @@ -526,7 +530,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr // Progress declared % print ''; - print $lines[$i]->progress.' %'; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); print ''; // Time spent diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index 9a1142fe5c0..e83fe30e865 100644 --- a/htdocs/projet/activity/list.php +++ b/htdocs/projet/activity/list.php @@ -83,6 +83,7 @@ if ($action == 'addtime' && $user->rights->projet->creer) foreach($timespent_duration as $key => $val) { $task->fetch($key); + $task->progress = GETPOST($key . 'progress', 'int'); $task->timespent_duration = $val; $task->timespent_fk_user = $user->id; $task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 13360110310..4788188aab3 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -785,6 +785,7 @@ class Task extends CommonObject { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; $sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'"; + $sql.= ", progress = " . $this->progress; $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 7e324841af2..766e954e2eb 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -166,7 +166,7 @@ $sql.= " WHERE p.entity = ".$conf->entity; if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; $sql.= " AND p.fk_statut=1"; -$sql.= " GROUP BY p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; +$sql.= " GROUP BY p.ref, p.title, p.rowid, t.label, t.rowid, u.rowid, t.planned_workload, t.dateo, t.datee"; $sql.= " ORDER BY u.rowid, t.dateo, t.datee"; $userstatic=new User($db); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 5c790df32f0..eff94d532e5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $langs->load('projects'); @@ -83,11 +84,11 @@ if ($action == 'addtimespent' && $user->rights->projet->creer) else { $object->timespent_note = $_POST["timespent_note"]; + $object->progress = GETPOST('progress', 'int'); $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 $object->timespent_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]); $object->timespent_fk_user = $_POST["userid"]; - $result=$object->addTimeSpent($user); if ($result >= 0) { @@ -185,6 +186,7 @@ if (! empty($project_ref) && ! empty($withproject)) llxHeader("",$langs->trans("Task")); $form = new Form($db); +$formother = new FormOther($db); $userstatic = new User($db); if ($id > 0 || ! empty($ref)) @@ -331,6 +333,7 @@ if ($id > 0 || ! empty($ref)) print ''.$langs->trans("Date").''; print ''.$langs->trans("By").''; print ''.$langs->trans("Note").''; + print ''.$langs->trans("Progress").''; print ''.$langs->trans("Duration").''; print ' '; print "\n"; @@ -360,6 +363,11 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + // Progress + print ''; + print $formother->select_percent($object->progress,'progress'); + print ''; + // Duration print ''; print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text');