diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index e9ceb2976802a02b7f0c5a943d3af77de51ddb11..d8ecc52f6d926eb0cff4cc0c49adc7fdeea1cd93 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 '<td align="right">'; - print $lines[$i]->progress.' %'; + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); print '</td>'; // Time spent diff --git a/htdocs/projet/activity/list.php b/htdocs/projet/activity/list.php index 9a1142fe5c0f0eb75386ba77d376d75abb8ea098..e83fe30e865b5a64c86a8d3ec8307edd065c5723 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 62052ebaa29ff235e77fd142d838fff4efd95e8b..ad3736d3abe8eb321a5a0a451e376ce162eea13f 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 d9fb4b4dce93660274bd86363221db737c7d5a68..bba783bf51e3f4ac0b7f2982986cb4ea2525bf6c 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 5c790df32f08e2e72ee3d5e5be761a4829c28671..eff94d532e506e1ee55bb90768947fb7cef028be 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 '<td width="100">'.$langs->trans("Date").'</td>'; print '<td>'.$langs->trans("By").'</td>'; print '<td>'.$langs->trans("Note").'</td>'; + print '<td>'.$langs->trans("Progress").'</td>'; print '<td align="right">'.$langs->trans("Duration").'</td>'; print '<td width="80"> </td>'; print "</tr>\n"; @@ -360,6 +363,11 @@ if ($id > 0 || ! empty($ref)) print '<textarea name="timespent_note" cols="80" rows="'.ROWS_3.'">'.($_POST['timespent_note']?$_POST['timespent_note']:'').'</textarea>'; print '</td>'; + // Progress + print '<td class="nowrap">'; + print $formother->select_percent($object->progress,'progress'); + print '</td>'; + // Duration print '<td class="nowrap" align="right">'; print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text');