Fix: management of time spent in task card
This commit is contained in:
parent
21c5d870ae
commit
d2dbbca945
@ -60,6 +60,9 @@ if ($_GET["id"] > 0)
|
|||||||
{
|
{
|
||||||
$result=$projectstatic->fetch($task->fk_project);
|
$result=$projectstatic->fetch($task->fk_project);
|
||||||
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
|
if (! empty($projectstatic->socid)) $projectstatic->societe->fetch($projectstatic->socid);
|
||||||
|
|
||||||
|
// To verify role of users
|
||||||
|
$userAccess = $projectstatic->restrictedProjectArea($user);
|
||||||
|
|
||||||
$head=task_prepare_head($task);
|
$head=task_prepare_head($task);
|
||||||
|
|
||||||
@ -67,9 +70,6 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
if ($mesg) print $mesg.'<br>';
|
if ($mesg) print $mesg.'<br>';
|
||||||
|
|
||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'">';
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="action" value="createtask">';
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@ -93,11 +93,34 @@ if ($_GET["id"] > 0)
|
|||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
// Add time spent
|
||||||
|
if ($user->rights->projet->creer && $userAccess)
|
||||||
|
{
|
||||||
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=addtime">'.$langs->trans('NewTimeSpent').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Modify').'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List of time spent
|
* List of time spent
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT t.task_date, t.task_duration, t.fk_user";
|
$sql = "SELECT t.rowid, t.task_date, t.task_duration, t.fk_user";
|
||||||
$sql.= ", u.rowid, u.name, u.firstname";
|
$sql.= ", u.rowid as userid, u.name, u.firstname";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t";
|
||||||
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
$sql .= " , ".MAIN_DB_PREFIX."user as u";
|
||||||
$sql .= " WHERE t.fk_task =".$task->id;
|
$sql .= " WHERE t.fk_task =".$task->id;
|
||||||
@ -123,38 +146,25 @@ if ($_GET["id"] > 0)
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table></form>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Actions
|
|
||||||
*/
|
|
||||||
print '<div class="tabsAction">';
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ($user->rights->projet->creer)
|
|
||||||
{
|
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$task->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
print '<input type="hidden" name="action" value="addtime">';
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("By").'</td>';
|
||||||
print '<td>'.$langs->trans("Date").'</td>';
|
print '<td>'.$langs->trans("Date").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||||
print '<td align="right">'.$langs->trans("By").'</td>';
|
print '<td colspan="2"> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
foreach ($tasks as $task_time)
|
foreach ($tasks as $task_time)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
|
// User
|
||||||
|
$user->id = $task_time->userid;
|
||||||
|
$user->nom = $task_time->name;
|
||||||
|
$user->prenom = $task_time->firstname;
|
||||||
|
print '<td>'.$user->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<td>'.dol_print_date($db->jdate($task_time->task_date),'%A').' '.dol_print_date($db->jdate($task_time->task_date),'daytext').'</td>';
|
print '<td>'.dol_print_date($db->jdate($task_time->task_date),'%A').' '.dol_print_date($db->jdate($task_time->task_date),'daytext').'</td>';
|
||||||
@ -164,13 +174,19 @@ if ($_GET["id"] > 0)
|
|||||||
$minutes = round((($task_time->task_duration - $heure) * 60),0);
|
$minutes = round((($task_time->task_duration - $heure) * 60),0);
|
||||||
$minutes = substr("00"."$minutes", -2);
|
$minutes = substr("00"."$minutes", -2);
|
||||||
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
print '<td align="right">'.$heure." h ".$minutes."</td>\n";
|
||||||
|
|
||||||
// User
|
// Icon update et delete
|
||||||
$user->id = $task_time->rowid;
|
print '<td align="center" nowrap>';
|
||||||
$user->nom = $task_time->name;
|
if ($user->rights->projet->creer && $userAccess)
|
||||||
$user->prenom = $task_time->firstname;
|
{
|
||||||
print '<td align="right">'.$user->getNomUrl(1).'</td>';
|
print ' ';
|
||||||
print "</tr>\n";
|
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$task->id.'&action=deleteline&lineid='.$task_time->rowid.'">';
|
||||||
|
print img_delete();
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user