Allow reporting progress along with timespent
This commit is contained in:
parent
f0551fe6d2
commit
769d824e7b
@ -445,7 +445,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
|||||||
*
|
*
|
||||||
* @param string $inc ?
|
* @param string $inc ?
|
||||||
* @param string $parent ?
|
* @param string $parent ?
|
||||||
* @param Object $lines ?
|
* @param Task[] $lines ?
|
||||||
* @param int $level ?
|
* @param int $level ?
|
||||||
* @param string $projectsrole ?
|
* @param string $projectsrole ?
|
||||||
* @param string $tasksrole ?
|
* @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)
|
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;
|
global $form, $projectstatic, $taskstatic;
|
||||||
|
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
|
||||||
$lastprojectid=0;
|
$lastprojectid=0;
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
@ -526,7 +530,7 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
|||||||
|
|
||||||
// Progress declared %
|
// Progress declared %
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print $lines[$i]->progress.' %';
|
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Time spent
|
// Time spent
|
||||||
|
|||||||
@ -83,6 +83,7 @@ if ($action == 'addtime' && $user->rights->projet->creer)
|
|||||||
foreach($timespent_duration as $key => $val)
|
foreach($timespent_duration as $key => $val)
|
||||||
{
|
{
|
||||||
$task->fetch($key);
|
$task->fetch($key);
|
||||||
|
$task->progress = GETPOST($key . 'progress', 'int');
|
||||||
$task->timespent_duration = $val;
|
$task->timespent_duration = $val;
|
||||||
$task->timespent_fk_user = $user->id;
|
$task->timespent_fk_user = $user->id;
|
||||||
$task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]);
|
$task->timespent_date = dol_mktime(12,0,0,$_POST["{$key}month"],$_POST["{$key}day"],$_POST["{$key}year"]);
|
||||||
|
|||||||
@ -785,6 +785,7 @@ class Task extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task";
|
||||||
$sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'";
|
$sql.= " SET duration_effective = duration_effective + '".price2num($this->timespent_duration)."'";
|
||||||
|
$sql.= ", progress = " . $this->progress;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG);
|
||||||
|
|||||||
@ -166,7 +166,7 @@ $sql.= " WHERE p.entity = ".$conf->entity;
|
|||||||
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
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.")";
|
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.= " 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";
|
$sql.= " ORDER BY u.rowid, t.dateo, t.datee";
|
||||||
|
|
||||||
$userstatic=new User($db);
|
$userstatic=new User($db);
|
||||||
|
|||||||
@ -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.'/projet/class/task.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.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/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
|
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
|
|
||||||
@ -83,11 +84,11 @@ if ($action == 'addtimespent' && $user->rights->projet->creer)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$object->timespent_note = $_POST["timespent_note"];
|
$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_durationhour"]*60*60; // We store duration in seconds
|
||||||
$object->timespent_duration+= $_POST["timespent_durationmin"]*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_date = dol_mktime(12,0,0,$_POST["timemonth"],$_POST["timeday"],$_POST["timeyear"]);
|
||||||
$object->timespent_fk_user = $_POST["userid"];
|
$object->timespent_fk_user = $_POST["userid"];
|
||||||
|
|
||||||
$result=$object->addTimeSpent($user);
|
$result=$object->addTimeSpent($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@ -185,6 +186,7 @@ if (! empty($project_ref) && ! empty($withproject))
|
|||||||
llxHeader("",$langs->trans("Task"));
|
llxHeader("",$langs->trans("Task"));
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
$userstatic = new User($db);
|
$userstatic = new User($db);
|
||||||
|
|
||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
@ -331,6 +333,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '<td width="100">'.$langs->trans("Date").'</td>';
|
print '<td width="100">'.$langs->trans("Date").'</td>';
|
||||||
print '<td>'.$langs->trans("By").'</td>';
|
print '<td>'.$langs->trans("By").'</td>';
|
||||||
print '<td>'.$langs->trans("Note").'</td>';
|
print '<td>'.$langs->trans("Note").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Progress").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("Duration").'</td>';
|
print '<td align="right">'.$langs->trans("Duration").'</td>';
|
||||||
print '<td width="80"> </td>';
|
print '<td width="80"> </td>';
|
||||||
print "</tr>\n";
|
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 '<textarea name="timespent_note" cols="80" rows="'.ROWS_3.'">'.($_POST['timespent_note']?$_POST['timespent_note']:'').'</textarea>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Progress
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
print $formother->select_percent($object->progress,'progress');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Duration
|
// Duration
|
||||||
print '<td class="nowrap" align="right">';
|
print '<td class="nowrap" align="right">';
|
||||||
print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text');
|
print $form->select_duration('timespent_duration',($_POST['timespent_duration']?$_POST['timespent_duration']:''),0,'text');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user