Prepare code for a perday week timesheet input of time spent.
This commit is contained in:
parent
416e0a766e
commit
a0f8b39250
@ -163,6 +163,38 @@ function task_prepare_head($object)
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param string $mode Mode
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function project_timesheet_prepare_head($mode)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("InputPerDay");
|
||||
$head[$h][2] = 'inputperday';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/pertime.php".($mode?'?mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("InputPerTime");
|
||||
$head[$h][2] = 'inputpertime';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet');
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
@ -448,7 +480,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
|
||||
|
||||
/**
|
||||
* Output a task line
|
||||
* Output a task line into a pertime intput mode
|
||||
*
|
||||
* @param string $inc ?
|
||||
* @param string $parent ?
|
||||
@ -460,7 +492,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||
* @return $inc
|
||||
*/
|
||||
function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
|
||||
function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
|
||||
{
|
||||
global $db, $user, $bc, $langs;
|
||||
global $form, $formother, $projectstatic, $taskstatic;
|
||||
@ -512,25 +544,15 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
|
||||
// Label task
|
||||
print "<td>";
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
print $taskstatic->getNomUrl(0);
|
||||
print "<br>";
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end);
|
||||
print "</td>\n";
|
||||
|
||||
// Date start
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_start,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Date end
|
||||
print '<td align="center">';
|
||||
print dol_print_date($lines[$i]->date_end,'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Planned Workload
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||
@ -589,7 +611,158 @@ function projectLinesb(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksr
|
||||
|
||||
$inc++;
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesb($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
if ($lines[$i]->id) projectLinesPerTime($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
$level--;
|
||||
}
|
||||
else
|
||||
{
|
||||
//$level--;
|
||||
}
|
||||
}
|
||||
|
||||
return $inc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Output a task line into a perday intput mode
|
||||
*
|
||||
* @param string $inc ?
|
||||
* @param string $parent ?
|
||||
* @param Task[] $lines ?
|
||||
* @param int $level ?
|
||||
* @param string $projectsrole ?
|
||||
* @param string $tasksrole ?
|
||||
* @param string $mine Show only task lines I am assigned to
|
||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||
* @return $inc
|
||||
*/
|
||||
function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$tasksrole, $mine, $restricteditformytask=0)
|
||||
{
|
||||
global $db, $user, $bc, $langs;
|
||||
global $form, $formother, $projectstatic, $taskstatic;
|
||||
|
||||
if (! is_object($formother))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($db);
|
||||
}
|
||||
|
||||
$lastprojectid=0;
|
||||
|
||||
$var=true;
|
||||
|
||||
$numlines=count($lines);
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
if ($parent == 0) $level = 0;
|
||||
|
||||
if ($lines[$i]->fk_parent == $parent)
|
||||
{
|
||||
// Break on a new project
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
$var = !$var;
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
}
|
||||
|
||||
// If we want all or we have a role on task, we show it
|
||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
// Project
|
||||
print "<td>";
|
||||
$projectstatic->id=$lines[$i]->fk_project;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
$projectstatic->public=$lines[$i]->public;
|
||||
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print "</td>";
|
||||
|
||||
// Ref
|
||||
print '<td>';
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
print $taskstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
// Label task
|
||||
print "<td>";
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
print $taskstatic->getNomUrl(0);
|
||||
print "<br>";
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end);
|
||||
print "</td>\n";
|
||||
|
||||
// Planned Workload
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->planned_workload) print convertSecondToTime($lines[$i]->planned_workload,'allhourmin');
|
||||
else print '--:--';
|
||||
print '</td>';
|
||||
|
||||
// Progress declared %
|
||||
print '<td align="right">';
|
||||
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
|
||||
print '</td>';
|
||||
|
||||
// Time spent
|
||||
print '<td align="right">';
|
||||
if ($lines[$i]->duration)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
|
||||
print convertSecondToTime($lines[$i]->duration,'allhourmin');
|
||||
print '</a>';
|
||||
}
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
|
||||
$disabledproject=1;$disabledtask=1;
|
||||
//print "x".$lines[$i]->fk_project;
|
||||
//var_dump($lines[$i]);
|
||||
//var_dump($projectsrole[$lines[$i]->fk_project]);
|
||||
// If at least one role for project
|
||||
if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer)
|
||||
{
|
||||
$disabledproject=0;
|
||||
$disabledtask=0;
|
||||
}
|
||||
// If $restricteditformytask is on and I have no role on task, i disable edit
|
||||
if ($restricteditformytask && empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
$disabledtask=1;
|
||||
}
|
||||
|
||||
// Fields to add new time
|
||||
print '<td align="right">';
|
||||
print $langs->trans("FeatureNotYetAvailable");
|
||||
/*
|
||||
print '<td class="nowrap" align="right">';
|
||||
$s='';
|
||||
$s.=$form->select_date('',$lines[$i]->id,0,0,2,"addtime",1,0,1,$disabledtask);
|
||||
$s.=' ';
|
||||
$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text',0,1);
|
||||
$s.=' <input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
|
||||
print $s;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$inc++;
|
||||
$level++;
|
||||
if ($lines[$i]->id) projectLinesPerDay($inc, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
$level--;
|
||||
}
|
||||
else
|
||||
|
||||
@ -244,12 +244,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perday.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create&mode=mine', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/index.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/list.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perday.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__);
|
||||
-- Tools
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3900__+MAX_llx_menu__, 'tools', 'mailing', 8__+MAX_llx_menu__, '/comm/mailing/index.php?leftmenu=mailing', 'EMailings', 0, 'mails', '$user->rights->mailing->lire', '', 0, 0, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->mailing->enabled', __HANDLER__, 'left', 3901__+MAX_llx_menu__, 'tools', '', 3900__+MAX_llx_menu__, '/comm/mailing/card.php?leftmenu=mailing&action=create', 'NewMailing', 1, 'mails', '$user->rights->mailing->creer', '', 0, 0, __ENTITY__);
|
||||
|
||||
@ -1148,13 +1148,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/projet/activity/index.php?mode=mine", $langs->trans("MyActivities"), 0, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks.php?action=create&mode=mine", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/tasks/index.php?mode=mine", $langs->trans("List"), 1, $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/activity/list.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/activity/perday.php?mode=mine", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer);
|
||||
|
||||
// All project i have permission on
|
||||
$newmenu->add("/projet/activity/index.php", $langs->trans("Activities"), 0, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/tasks.php?action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/tasks/index.php", $langs->trans("List"), 1, $user->rights->projet->lire && $user->rights->projet->lire);
|
||||
$newmenu->add("/projet/activity/list.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
$newmenu->add("/projet/activity/perday.php", $langs->trans("NewTimeSpent"), 1, $user->rights->projet->creer && $user->rights->projet->creer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,3 +135,5 @@ SearchAProject=Search a project
|
||||
ProjectMustBeValidatedFirst=Project must be validated first
|
||||
ProjectDraft=Draft projects
|
||||
FirstAddRessourceToAllocateTime=Associate a ressource to allocate time
|
||||
InputPerTime=Input per time
|
||||
InputPerDay=Input per day
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 François Legastelois <flegastelois@teclib.com>
|
||||
*
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/projet/activity/list.php
|
||||
* \file htdocs/projet/activity/pertime.php
|
||||
* \ingroup projet
|
||||
* \brief List activities of tasks
|
||||
* \brief List activities of tasks (per time entry)
|
||||
*/
|
||||
|
||||
require ("../../main.inc.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');
|
||||
|
||||
@ -56,50 +57,8 @@ if ($action == 'addtime' && $user->rights->projet->creer)
|
||||
{
|
||||
$task = new Task($db);
|
||||
|
||||
$timespent_duration=array();
|
||||
|
||||
foreach($_POST as $key => $time)
|
||||
{
|
||||
if (intval($time) > 0)
|
||||
{
|
||||
// Hours or minutes
|
||||
if (preg_match("/([0-9]+)(hour|min)/",$key,$matches))
|
||||
{
|
||||
$id = $matches[1];
|
||||
if ($id > 0)
|
||||
{
|
||||
// We store HOURS in seconds
|
||||
if($matches[2]=='hour') $timespent_duration[$id] += $time*60*60;
|
||||
|
||||
// We store MINUTES in seconds
|
||||
if($matches[2]=='min') $timespent_duration[$id] += $time*60;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($timespent_duration) > 0)
|
||||
{
|
||||
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"]);
|
||||
$task->addTimeSpent($user);
|
||||
}
|
||||
|
||||
setEventMessage($langs->trans("RecordSaved"));
|
||||
|
||||
// Redirect to avoid submit twice on back
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$projectid.($mode?'&mode='.$mode:''));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorTimeSpentIsEmpty"), 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +68,7 @@ if ($action == 'addtime' && $user->rights->projet->creer)
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$projectstatic=new Project($db);
|
||||
$project = new Project($db);
|
||||
$taskstatic = new Task($db);
|
||||
@ -138,6 +98,15 @@ llxHeader("",$title,"");
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, "", $num);
|
||||
|
||||
|
||||
print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addtime">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
$head=project_timesheet_prepare_head($mode);
|
||||
dol_fiche_head($head, 'inputperday', '', 0, 'task');
|
||||
|
||||
// Show description of content
|
||||
if ($mine) print $langs->trans("MyTasksDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'<br><br>';
|
||||
else
|
||||
@ -145,7 +114,7 @@ else
|
||||
if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopened?' '.$langs->trans("OnlyOpenedProject"):'').'<br><br>';
|
||||
else print $langs->trans("ProjectsPublicTaskDesc").($onlyopened?' '.$langs->trans("AlsoOnlyOpenedProject"):'').'<br><br>';
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
// Filter on user
|
||||
/* dol_fiche_head('');
|
||||
@ -167,22 +136,15 @@ else
|
||||
dol_fiche_end();
|
||||
*/
|
||||
|
||||
print '<form name="addtime" method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$project->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addtime">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Project").'</td>';
|
||||
print '<td>'.$langs->trans("RefTask").'</td>';
|
||||
print '<td>'.$langs->trans("LabelTask").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateStart").'</td>';
|
||||
print '<td align="center">'.$langs->trans("DateEnd").'</td>';
|
||||
print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>';
|
||||
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
|
||||
print '<td colspan="2" align="right">'.$langs->trans("NewTimeSpent").'</td>';
|
||||
print '<td colspan="2" align="right">'.$langs->trans("xxx").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// By default, we can edit only tasks we are assigned to
|
||||
@ -190,13 +152,17 @@ $restricteditformytask=(empty($conf->global->PROJECT_TIME_ON_ALL_TASKS_MY_PROJEC
|
||||
|
||||
if (count($tasksarray) > 0)
|
||||
{
|
||||
projectLinesb($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
$j=0;
|
||||
projectLinesPerDay($j, 0, $tasksarray, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="10">'.$langs->trans("NoTasks").'</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -751,7 +751,7 @@ class Task extends CommonObject
|
||||
/**
|
||||
* Add time spent
|
||||
*
|
||||
* @param User $user user id
|
||||
* @param User $user User object
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return void
|
||||
*/
|
||||
@ -761,6 +761,13 @@ class Task extends CommonObject
|
||||
|
||||
$ret = 0;
|
||||
|
||||
// Check parameters
|
||||
if (! is_object($user))
|
||||
{
|
||||
dol_print_error('',"Method addTimeSpent was called with wrong parameter user");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->timespent_note)) $this->timespent_note = trim($this->timespent_note);
|
||||
if (empty($this->timespent_datehour)) $this->timespent_datehour = $this->timespent_date;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user